Skip to content

Commit

Permalink
Change string to int array for serialized ATN for JavaScript (#3568)
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt authored Mar 7, 2022
1 parent 3afd899 commit 219ab7e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion runtime/JavaScript/src/antlr4/atn/ATNDeserializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ATNDeserializer {
}

deserialize(data) {
this.data = data.split("").map(c => c.charCodeAt(0));
this.data = data
this.pos = 0;
this.checkVersion();
const atn = this.readATN();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,7 @@ export default class <lexer.name> extends <if(superClass)><superClass><else>antl
>>

SerializedATN(model) ::= <<
<! only one segment, can be inlined !>

const serializedATN = ["<model.serialized; wrap={",<\n> "}>"].join("");
const serializedATN = [<model.serialized: {s | <s>}; separator=",", wrap>];

>>

Expand Down
2 changes: 1 addition & 1 deletion tool/src/org/antlr/v4/codegen/target/JavaScriptTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ public boolean supportsOverloadedMethods() {

@Override
public boolean isATNSerializedAsInts() {
return false;
return true;
}
}

0 comments on commit 219ab7e

Please sign in to comment.