java-parser
Advanced tools
Comparing version 0.3.1 to 0.3.2
{ | ||
"name": "java-parser", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Java Parser in JavaScript", | ||
@@ -16,3 +16,3 @@ "main": "src/index.js", | ||
}, | ||
"gitHead": "1a90f422fac6fcf686523485fe67c60756a0eec5" | ||
"gitHead": "5fa8b9b6177ba65955d7f694a4b3966febc529bc" | ||
} |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, no-console */ | ||
/** | ||
@@ -3,0 +2,0 @@ * This Script is used to debug the parsing of **small** code snippets. |
@@ -36,3 +36,3 @@ "use strict"; | ||
function pushInUnicode(cat, elt) { | ||
if (!unicode.hasOwnProperty(cat)) { | ||
if (!Object.prototype.hasOwnProperty.call(unicode, cat)) { | ||
unicode[cat] = { | ||
@@ -39,0 +39,0 @@ unicode: [], |
/* eslint-disable no-unused-vars */ | ||
"use strict"; | ||
const { createToken: createTokenOrg, Lexer } = require("chevrotain"); | ||
const fs = require("fs"); | ||
let chars; | ||
@@ -42,2 +41,18 @@ // A little mini DSL for easier lexer definition. | ||
FRAGMENT("LineTerminator", "(\\x0A|(\\x0D(\\x0A)?))"); | ||
FRAGMENT("UnicodeMarker", "uu*"); | ||
FRAGMENT("UnicodeEscape", "\\\\{{UnicodeMarker}}{{HexDigit}}{4}"); | ||
FRAGMENT("RawInputCharacter", "\\\\{{UnicodeMarker}}[0-9a-fA-F]{4}"); | ||
FRAGMENT("UnicodeInputCharacter", "({{UnicodeEscape}}|{{RawInputCharacter}})"); | ||
FRAGMENT("OctalDigit", "[0-7]"); | ||
FRAGMENT("ZeroToThree", "[0-3]"); | ||
FRAGMENT( | ||
"OctalEscape", | ||
"\\\\({{OctalDigit}}|{{ZeroToThree}}?{{OctalDigit}}{2})" | ||
); | ||
FRAGMENT("EscapeSequence", "\\\\[btnfr\"'\\\\]|{{OctalEscape}}"); | ||
// Not using InputCharacter terminology there because CR and LF are already captured in EscapeSequence | ||
FRAGMENT( | ||
"StringCharacter", | ||
"(?:(?:{{EscapeSequence}})|{{UnicodeInputCharacter}})" | ||
); | ||
@@ -203,8 +218,10 @@ function matchJavaIdentifier(text, startOffset) { | ||
name: "CharLiteral", | ||
pattern: /'(?:[^\\']|\\(?:(?:[btnfr"'\\/]|[0-7]|[0-7]{2}|[0-3][0-7]{2})|u[0-9a-fA-F]{4}))'/ | ||
// Not using SingleCharacter Terminology because ' and \ are captured in EscapeSequence | ||
pattern: MAKE_PATTERN( | ||
"'(?:[^\\\\']|(?:(?:{{EscapeSequence}})|{{UnicodeInputCharacter}}))'" | ||
) | ||
}); | ||
createToken({ | ||
name: "StringLiteral", | ||
// TODO: align with the spec, the pattern below is incorrect | ||
pattern: /"[^"\\]*(\\.[^"\\]*)*"/ | ||
pattern: MAKE_PATTERN('"(?:[^\\\\"]|{{StringCharacter}})*"') | ||
}); | ||
@@ -211,0 +228,0 @@ |
/*File generated with ../scripts/unicode.js using ../resources/Unicode/UnicodeData.txt. | ||
* As Java Identifiers may contains unicodes letters, this file defines two sets of unicode | ||
* characters, firstIdentChar used to help to determine if a character can be the first letter | ||
* of a JavaIdentifier and the other one (restIdentChar) to determine if it can be part of a | ||
* JavaIdentifier other than the first character. | ||
* Java uses the same file UnicodeData.txt as the unicode.js script to define the unicodes. | ||
* For more: | ||
* https://github.com/jhipster/prettier-java/issues/116 | ||
* https://github.com/jhipster/prettier-java/pull/155 | ||
*/ | ||
* As Java Identifiers may contains unicodes letters, this file defines two sets of unicode | ||
* characters, firstIdentChar used to help to determine if a character can be the first letter | ||
* of a JavaIdentifier and the other one (restIdentChar) to determine if it can be part of a | ||
* JavaIdentifier other than the first character. | ||
* Java uses the same file UnicodeData.txt as the unicode.js script to define the unicodes. | ||
* For more: | ||
* https://github.com/jhipster/prettier-java/issues/116 | ||
* https://github.com/jhipster/prettier-java/pull/155 | ||
*/ | ||
"use strict"; | ||
@@ -12,0 +12,0 @@ const addRanges = (set, rangesArr) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1993811
6745
6