Skip to content

Commit

Permalink
Update JavaScript like antlr#3380
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed Dec 1, 2021
1 parent a5dfd61 commit 3a5f112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions tool/src/org/antlr/v4/codegen/target/GoTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public String encodeIntAsCharEscape(int v) {
public int getSerializedATNSegmentLimit() {
// 65535 is the class file format byte limit for a UTF-8 encoded string literal
// 3 is the maximum number of bytes it takes to encode a value in the range 0-0xFFFF
// (Mimicking Java here; not sure of true limit)
return 65535 / 3;
}

Expand Down
5 changes: 4 additions & 1 deletion tool/src/org/antlr/v4/codegen/target/JavaScriptTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ public String encodeIntAsCharEscape(int v) {

@Override
public int getSerializedATNSegmentLimit() {
return 2 ^ 31;
// 65535 is the class file format byte limit for a UTF-8 encoded string literal
// 3 is the maximum number of bytes it takes to encode a value in the range 0-0xFFFF
// (Mimicking Java here; not sure of true limit)
return 65535 / 3;
}

@Override
Expand Down

0 comments on commit 3a5f112

Please sign in to comment.