Skip to content

Commit

Permalink
change filenames and set strict in tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
FineArchs committed Nov 3, 2023
1 parent 2b08f5e commit c449f67
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 41 deletions.
5 changes: 2 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<script setup lang='ts'>
import { ref } from 'vue';
import V0_16_0 from './versions/0.16.0/V0_16_0.vue';
import V0_15_0 from './versions/0.15.0/V0_15_0.vue';
import V0_16_0 from './versions/0.16.0/index.vue';
import V0_15_0 from './versions/0.15.0/index.vue';
const version = ref('0.16.0');
const versions = ['0.16.0', '0.15.0'] as const;
Expand Down Expand Up @@ -50,7 +50,6 @@ body {
h1 {
font-size: 1.5em;
/* font-weight: bold; */
margin: 16px 16px 0 16px;
}
Expand Down
61 changes: 28 additions & 33 deletions src/versions/0.15.0/V0_15_0.vue → src/versions/0.15.0/index.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,33 @@
<template>
<div id="root">
<div id="grid1">
<div id="editor" class="container">
<header>Input<div class="actions"><button @click="setCode">FizzBuzz</button></div></header>
<div>
<PrismEditor class="code" v-model="script" :highlight="highlighter" :line-numbers="false"/>
</div>
<footer>
<Container id='editor'>
<template #header>
Input<div class="actions"><button @click="setCode">FizzBuzz</button></div>
</template>
<PrismEditor class="code" v-model="script" :highlight="highlighter" :line-numbers="false"/>
<template #footer>
<span v-if="syntaxErrorMessage" class="syntaxError">{{ syntaxErrorMessage }}</span>
<div class="actions"><button @click="run">RUN</button></div>
</footer>
</div>
<div id="logs" class="container">
<header>Output</header>
<div>
<div v-for="log in logs" class="log" :key="log.id" :class="[{ print: log.print }, log.type]"><span class="type">{{ log.type }}</span> {{ log.text }}</div>
</div>
</div>
</template>
</Container>
<Container id='logs'>
<template #header>Output</template>
<div v-for="log in logs" class="log" :key="log.id" :class="[{ print: log.print }, log.type]"><span class="type">{{ log.type }}</span> {{ log.text }}</div>
</Container>
</div>
<div id="grid2">
<div id="ast" class="container">
<header>AST</header>
<div>
<pre>{{ JSON.stringify(ast, null, '\t') }}</pre>
</div>
</div>
<div id="bin" class="container">
<header>Bytecode</header>
<div>
</div>
</div>
<div id="debugger" class="container">
<header>Debugger</header>
<div>
</div>
</div>
<Container id='ast'>
<template #header>AST</template>
<pre>{{ JSON.stringify(ast, null, '\t') }}</pre>
</Container>
<Container id='bin'>
<template #header>Bytecode</template>
<header></header>
</Container>
<Container id='debugger'>
<template #header>Debugger</template>
</Container>
</div>
</div>
</template>
Expand All @@ -54,6 +47,7 @@ import { highlight, languages } from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';
import 'prismjs/themes/prism-okaidia.css';
import Container from '@common/Container.vue';
// 使う場所はそんなにないしとりあえずunknownで
type Grammer = unknown;
Expand All @@ -79,8 +73,9 @@ watch(script, () => {
ast.value = Parser.parse(script.value);
syntaxErrorMessage.value = null;
} catch (e) {
syntaxErrorMessage.value = e.message;
console.error(e.info);
const err = e as Error;
syntaxErrorMessage.value = err.message;
console.error(('info' in err) ? err.info : err);
return;
}
}, {
Expand Down Expand Up @@ -132,7 +127,7 @@ const run = async () => {
await interpreter.exec(ast.value!);
} catch (e) {
console.error(e);
window.alert(e.toString());
window.alert(`{e}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ watch(script, () => {
ast.value = Parser.parse(script.value);
syntaxErrorMessage.value = null;
} catch (e) {
syntaxErrorMessage.value = e.message;
console.error(e.info);
const err = e as Error;
syntaxErrorMessage.value = err.message;
console.error(('info' in err) ? err.info : err);
return;
}
}, {
Expand Down
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUncheckedIndexedAccess": true,
"strictNullChecks": true,
"target": "es2022",
"importHelpers": true,
"isolatedModules": true,
Expand Down

0 comments on commit c449f67

Please sign in to comment.