Skip to content

Commit

Permalink
support single quote in escape; bump 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Apr 21, 2021
1 parent bf629b4 commit 3bd349d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cirru/parser.ts",
"version": "0.0.2",
"version": "0.0.3",
"description": "Cirru Parser in TypeScript",
"main": "lib/index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ let lex = (initialCode: string) => {
case '"':
[acc, state, buffer] = [acc, ELexState.string, `${buffer}"`];
break;
case "'":
[acc, state, buffer] = [acc, ELexState.string, `${buffer}'`];
break;
case "t":
[acc, state, buffer] = [acc, ELexState.string, `${buffer}\t`];
break;
Expand Down
2 changes: 2 additions & 0 deletions src/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ let fs = require("fs");
let path = require("path");
let { parse } = require("./index");

test("single quote", () => expect(parse('a "\\\'"')).toEqual([["a", "'"]]));

test("demo", () => {
let code = fs.readFileSync(path.join(__dirname, "../test/cirru/demo.cirru"), "utf8");
let data = require(path.join(__dirname, "../test/ast/demo.json"));
Expand Down

0 comments on commit 3bd349d

Please sign in to comment.