From 8884fde58ba5367ee7f3629667df2519d2bcdaf1 Mon Sep 17 00:00:00 2001 From: marihachi Date: Sat, 1 Feb 2020 16:10:25 +0900 Subject: [PATCH] :cat: --- .gitignore | 2 ++ package.json | 8 ++++++-- src/client/{mainEntry.ts => main-entry.ts} | 6 +++--- src/index.ts | 6 +++--- src/parser/{coreParser.pegjs => core-parser.pegjs} | 0 src/parser/{pegParser.d.ts => peg-parser.d.ts} | 0 webpack.config.js | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) rename src/client/{mainEntry.ts => main-entry.ts} (56%) rename src/parser/{coreParser.pegjs => core-parser.pegjs} (100%) rename src/parser/{pegParser.d.ts => peg-parser.d.ts} (100%) diff --git a/.gitignore b/.gitignore index dfa7854..ed70925 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ node_modules built package-lock.json + temp +syuilo-parser* diff --git a/package.json b/package.json index 5b11a7f..b9e04e9 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "build": "npm run peg && npm run tsc && npm run webpack", "build-dev": "npm run peg-dev && npm run tsc && npm run webpack-dev", - "peg": "mkdirp ./built/parser && pegjs -o built/parser/coreParser.js src/parser/coreParser.pegjs", - "peg-dev": "mkdirp ./built/parser && pegjs -o built/parser/coreParser.js --trace src/parser/coreParser.pegjs", + "peg": "mkdirp ./built/parser && pegjs -o built/parser/core-parser.js src/parser/core-parser.pegjs", + "peg-dev": "mkdirp ./built/parser && pegjs -o built/parser/core-parser.js --trace src/parser/core-parser.pegjs", "tsc": "tsc", "webpack": "webpack --mode=production", "webpack-dev": "webpack --mode=development", @@ -26,5 +26,9 @@ "typescript": "3.7.x", "webpack": "4.40.x", "webpack-cli": "3.3.x" + }, + "dependencies": { + "@types/parsimmon": "^1.10.1", + "parsimmon": "^1.13.0" } } diff --git a/src/client/mainEntry.ts b/src/client/main-entry.ts similarity index 56% rename from src/client/mainEntry.ts rename to src/client/main-entry.ts index 1fb7479..ac3038f 100644 --- a/src/client/mainEntry.ts +++ b/src/client/main-entry.ts @@ -1,13 +1,13 @@ -import { PegParser } from '../parser/pegParser'; +import { PegParser } from '../parser/peg-parser'; async function entryPoint() { - const coreParser: PegParser = require('../../built/parser/coreParser.js'); + const coreParser: PegParser = require('../../built/parser/core-parser.js'); const input = '[hoge]'; console.log('parsing input:', input); const result = coreParser.parse(input); console.log('parsing result:'); - console.log(result); + console.log(JSON.stringify(result)); } entryPoint() .catch(err => console.log(err)); diff --git a/src/index.ts b/src/index.ts index a2c8589..9e1c11c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ -import { PegParser } from './parser/pegParser'; +import { PegParser } from './parser/peg-parser'; -const coreParser: PegParser = require('./parser/coreParser'); +const coreParser: PegParser = require('./parser/core-parser'); const input = '[hoge]'; console.log('parsing input:', input); const result = coreParser.parse(input); console.log('parsing result:'); -console.log(result); +console.log(JSON.stringify(result)); diff --git a/src/parser/coreParser.pegjs b/src/parser/core-parser.pegjs similarity index 100% rename from src/parser/coreParser.pegjs rename to src/parser/core-parser.pegjs diff --git a/src/parser/pegParser.d.ts b/src/parser/peg-parser.d.ts similarity index 100% rename from src/parser/pegParser.d.ts rename to src/parser/peg-parser.d.ts diff --git a/webpack.config.js b/webpack.config.js index a2d36e3..3cca1c5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,5 @@ module.exports = { - entry: './src/client/mainEntry.ts', + entry: './src/client/main-entry.ts', output: { path: `${__dirname}/built/client`, publicPath: '/', // base path of URL