-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes in code which is rarely used (and therefore had no tests)
- Found and fixed an issue with left recursive rules. - Added a serialization/deserialization unit test. - Fixed missing ambiguity info in parse info (note: tests still pending for that). Signed-off-by: Mike Lischke <[email protected]>
- Loading branch information
1 parent
213870f
commit 9daf2ea
Showing
10 changed files
with
94 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. | ||
* Use of this file is governed by the BSD 3-clause license that | ||
* can be found in the LICENSE.txt file in the project root. | ||
*/ | ||
|
||
import { describe, expect, it } from "vitest"; | ||
|
||
import { ATNDeserializer, ATNSerializer } from "../../src/index.js"; | ||
import { MySQLLexer } from "../benchmarks/generated/MySQLLexer.js"; | ||
import { MySQLParser } from "../benchmarks/generated/MySQLParser.js"; | ||
|
||
describe("Test Serialization and Deserialization", () => { | ||
it("Lexer", () => { | ||
// eslint-disable-next-line no-underscore-dangle | ||
const serialized = MySQLLexer._serializedATN; | ||
|
||
const deserializer = new ATNDeserializer(); | ||
const atn = deserializer.deserialize(serialized); | ||
|
||
const serializer = new ATNSerializer(atn); | ||
const serialized2 = serializer.serialize(); | ||
|
||
expect(serialized2.length).toBe(serialized.length); | ||
|
||
expect(serialized2).toEqual(serialized); | ||
}); | ||
|
||
it("Parser", () => { | ||
// eslint-disable-next-line no-underscore-dangle | ||
const serialized = MySQLParser._serializedATN; | ||
|
||
const deserializer = new ATNDeserializer(); | ||
const atn = deserializer.deserialize(serialized); | ||
|
||
const serializer = new ATNSerializer(atn); | ||
const serialized2 = serializer.serialize(); | ||
|
||
expect(serialized2.length).toBe(serialized.length); | ||
|
||
expect(serialized2).toEqual(serialized); | ||
}); | ||
}); |