diff --git a/ide/xml.lexer/src/org/netbeans/lib/xml/lexer/DTDLexer.java b/ide/xml.lexer/src/org/netbeans/lib/xml/lexer/DTDLexer.java index 216a51a033ba..df480c937579 100644 --- a/ide/xml.lexer/src/org/netbeans/lib/xml/lexer/DTDLexer.java +++ b/ide/xml.lexer/src/org/netbeans/lib/xml/lexer/DTDLexer.java @@ -35,7 +35,7 @@ * New simple implementation of DTD lexer. Unlike XML lexer, this one does not attempt * to report erroneous token based on context; so keyword is a keyword (almost) on all places. Syntax * analyzer is needed to report premature ends or invalid combinations / sequences of tokens. - * + * * @author sdedic */ public class DTDLexer implements Lexer { @@ -43,68 +43,69 @@ public class DTDLexer implements Lexer { * Default state outside declarations or instructions */ private static final int ISI_INIT = 0; - + /** * Plaintext outside declarations */ private static final int ISI_TEXT = 1; - + /** * &? processing instruction */ private static final int ISI_PROCESSING_INSTR = 2; - + /** * DTD declaration */ private static final int ISI_DECLARATION = 3; - + private static final int ISI_ENTITY = 4; private static final int ISI_ELEMENT = 5; private static final int ISI_ATTLIST = 6; private static final int ISI_NOTATION = 7; - + /** * Comment */ private static final int ISI_COMMENT = 8; - + /** * Declaration processing; after initial symbol & before the target */ private static final int SUB_PROCESSING_TARGET = 0; - + /** * Declaration processing; after target - content is being processed */ private static final int SUB_PROCESSING_CONTENT = 1; - + /** * XML declaration is being processed; in between attributes, after * attribute name and before value */ private static final int SUB_PROCESSING_XML = 2; - + private static final int SUB_DECLARATION_NAME = 0; private static final int SUB_DECLARATION_DEF = 1; private static final int SUB_VALUE_QUOTE = 5; private static final int SUB_VALUE_DOUBLE = 6; - - private LexerInput input; + + private final LexerInput input; private int state; private int substate; private int intrSubstate; - - private TokenFactory tokenFactory; - + + private final TokenFactory tokenFactory; + private Token unterminatedFoundOpen() { int ch = input.read(); switch (ch) { - case '?': + case '?' -> { setState(ISI_PROCESSING_INSTR, SUB_PROCESSING_TARGET); return error(); - case '!': + } + case '!' -> { ch = input.read(); if (Character.isAlphabetic(ch)) { // directive; symbol @@ -120,12 +121,13 @@ private Token unterminatedFoundOpen() { } input.backup(1); return error(); - + } } input.backup(1); return error(); } - + + @SuppressWarnings("fallthrough") public Token nextTokenInit() { int ch = input.read(); Token tukac = null; @@ -133,11 +135,12 @@ public Token nextTokenInit() { case '<': { // NOI18N ch = input.read(); switch (ch) { - case '?': // NOI18N + case '?' -> { // NOI18N // processing instruction; symbol setState(ISI_PROCESSING_INSTR, SUB_PROCESSING_TARGET); return tokenFactory.createToken(DTDTokenId.SYMBOL); - case '!': { // NOI18N + } + case '!' -> { // NOI18N ch = input.read(); if (Character.isAlphabetic(ch)) { // directive; symbol @@ -154,9 +157,9 @@ public Token nextTokenInit() { input.backup(1); return tokenFactory.createToken(DTDTokenId.ERROR); } - default: + default -> { // fall through - break; + } } } case '&': @@ -174,7 +177,8 @@ public Token nextTokenInit() { } return nextTokenContent(); } - + + @SuppressWarnings("NestedAssignment") private Token processCharacterReference() { int ch = input.read(); boolean hex = ch == 'x'; @@ -194,19 +198,18 @@ private Token processCharacterReference() { } while ((ch = input.read()) != LexerInput.EOF); return createReferenceToken(first ? DTDTokenId.ERROR : DTDTokenId.CHARACTER); } - + private Token createReferenceToken(DTDTokenId id) { Token t = intrSubstate != 0 ? tokenFactory.createToken(id, input.readLength(), PartType.MIDDLE) : tokenFactory.createToken(id); return t; } - + private Token processEntityOrCharacterRef() { - int ch; boolean first = true; - Token t = null; - while ((ch = input.read()) != LexerInput.EOF) { + Token t; + for (int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == ';') { return first ? error() : createReferenceToken(DTDTokenId.REFERENCE); } @@ -220,24 +223,24 @@ private Token processEntityOrCharacterRef() { return error(); } } - if (!((first && Character.isLetter(ch)) || + if (!((first && Character.isLetter(ch)) || (!first && ( ch == '-' || ch == '.' || Character.isLetterOrDigit(ch))))) { // not an entity reference, fall back to normal text processing input.backup(1); break; - } + } first = false; } // end of document inside potential reference return error(); } - + + @SuppressWarnings("AssignmentToForLoopParameter") private Token skipComment() { - int ch; boolean minus = false; setState(ISI_COMMENT); - while ((ch = input.read()) != LexerInput.EOF) { + for (int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == '-') { if (minus) { ch = input.read(); @@ -279,24 +282,24 @@ private Token skipComment() { return tokenFactory.createToken(DTDTokenId.ERROR); } } - + private void setState(int state) { setState(state, 0); } - + private void setState(int state, int subState) { this.state = state; this.substate = subState; intrSubstate = 0; } - + /** * Regular content. * Stop at first 'markup' character. */ + @SuppressWarnings("fallthrough") private Token nextTokenContent() { - int ch; - while ((ch = input.read()) != LexerInput.EOF) { + for (int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { switch (ch) { case '<': // retract a bit: @@ -333,42 +336,42 @@ private Token nextTokenContent() { } return tokenFactory.createToken(DTDTokenId.PLAIN); } - + private Token processParsedEntity() { - int ch; boolean first = true; - while ((ch = input.read()) != LexerInput.EOF) { + for (int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == ';') { return first ? null : tokenFactory.createToken(DTDTokenId.REFERENCE); } - if (!((first && Character.isLetter(ch)) || + if (!((first && Character.isLetter(ch)) || (!first && ( ch == '-' || ch == '.' || Character.isLetterOrDigit(ch))))) { // not an entity reference, fall back to normal text processing: break; - } + } first = false; } return null; } - + @Override public Token nextToken() { switch (state) { - case ISI_INIT: + case ISI_INIT -> { return nextTokenInit(); - case ISI_COMMENT: + } + case ISI_COMMENT -> { return skipComment(); - case ISI_PROCESSING_INSTR: + } + case ISI_PROCESSING_INSTR -> { return nextProcessingInstr(); - case ISI_DECLARATION: + } + case ISI_DECLARATION -> { return nextDeclaration(); - case ISI_ELEMENT: - case ISI_ATTLIST: - return processElementOrAttlist(); - case ISI_ENTITY: - case ISI_NOTATION: - break; + } + case ISI_ELEMENT, ISI_ATTLIST, ISI_NOTATION, ISI_ENTITY -> { + return processElementOrAttlistOrNotionOrEntity(); + } } int ch = input.read(); if (ch != LexerInput.EOF) { @@ -377,15 +380,17 @@ public Token nextToken() { return null; } } - - private Token processElementOrAttlist() { + + private Token processElementOrAttlistOrNotionOrEntity() { switch (substate) { - case SUB_VALUE_DOUBLE: + case SUB_VALUE_DOUBLE -> { restoreState(); return stringvalue('"'); - case SUB_VALUE_QUOTE: + } + case SUB_VALUE_QUOTE -> { restoreState(); return stringvalue('\''); + } } Token wh = skipWhitespace(); if (wh != null) { @@ -399,20 +404,24 @@ private Token processElementOrAttlist() { // terminate definition setState(ISI_INIT); return tokenFactory.createToken(DTDTokenId.SYMBOL); + } else if (ch == '%' && state == ISI_ENTITY) { + return tokenFactory.createToken(DTDTokenId.OPERATOR); } else if (ch == '&' || ch == '%') { return processEntityOrCharacterRef(); } switch (substate) { - case SUB_DECLARATION_NAME: + case SUB_DECLARATION_NAME -> { input.backup(1); return processDeclarationName(); - case SUB_DECLARATION_DEF: + } + case SUB_DECLARATION_DEF -> { input.backup(1); return processDeclarationDef(); + } } return error(); } - + private static final Map DECLARATION_KEYWORDS = new HashMap<>(); /** @@ -425,17 +434,20 @@ private Token processElementOrAttlist() { DECLARATION_KEYWORDS.put("ENTITY", ISI_ENTITY); DECLARATION_KEYWORDS.put("NOTATION", ISI_NOTATION); } - + + @SuppressWarnings("NestedAssignment") private Token nextDeclaration() { int ch = input.read(); // process escapes: switch (ch) { - case '>': + case '>' -> { // end of declaration setState(ISI_INIT); return tokenFactory.createToken(DTDTokenId.SYMBOL); - case '<': + } + case '<' -> { return unterminatedFoundOpen(); + } } if (!Character.isLetter(ch)) { return error(); @@ -459,11 +471,10 @@ private Token nextDeclaration() { setState(nState); return tokenFactory.createToken(DTDTokenId.DECLARATION); } - + private Token processDeclarationName() { - int ch; boolean first = true; - while ((ch = input.read()) != LexerInput.EOF) { + for (int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (first && (ch == '%') && (state == ISI_ENTITY)) { int n = input.read(); if (Character.isWhitespace(n)) { @@ -509,12 +520,12 @@ private Token processDeclarationName() { * Keywords possible after <!ATTLIST. */ private static final Set ATTLIST_KEYWORDS = new HashSet<>(); - + /** * Keywords possible after <!NOTATION. */ private static final Set NOTATION_KEYWORDS = new HashSet<>(); - + static { ATTLIST_KEYWORDS.add("#PCDATA"); ATTLIST_KEYWORDS.add("#REQUIRED"); @@ -529,74 +540,66 @@ private Token processDeclarationName() { ATTLIST_KEYWORDS.add("#REQUIRED"); ATTLIST_KEYWORDS.add("#IMPLIED"); ATTLIST_KEYWORDS.add("#FIXED"); - + NOTATION_KEYWORDS.add("SYSTEM"); NOTATION_KEYWORDS.add("PUBLIC"); NOTATION_KEYWORDS.add("NDATA"); } - + + @SuppressWarnings("NestedAssignment") private Token processDeclarationDef() { Token wh = skipWhitespace(); if (wh != null) { return wh; } int ch = input.read(); - + switch (ch) { - case '(': case ')': case '|': case ',': // NOI18N - case '+': // NOI18N - case '*': // NOI18N - case '?': // NOI18N + case '(', ')', '|', ',', '+', '*', '?' -> { // NOI18N return tokenFactory.createToken(DTDTokenId.OPERATOR); - - case '%': case '&': // NOI18N + } + case '%', '&' -> { // NOI18N return processEntityOrCharacterRef(); - - case '"': case '\'': // NOI18N + } + case '"', '\'' -> { // NOI18N return stringvalue(ch); - - default: - if (ch == '#' || Character.isLetter(ch)) { // NOI18N - while ((ch = input.read()) != LexerInput.EOF && - Character.isLetterOrDigit(ch)) { + } + default -> { + /* missing: combiner + extended characters */ + if (ch == '#' || Character.isLetterOrDigit(ch) || ch == '.' || ch == ':' || ch == '-' ) { // NOI18N + while ((ch = input.read()) != LexerInput.EOF && (Character.isLetterOrDigit(ch) || ch == '.' || ch == ':' || ch == '-')) { // advance } input.backup(1); String t = input.readText().toString(); Set check; - switch (state) { - case ISI_ATTLIST: - check = ATTLIST_KEYWORDS; - break; - case ISI_ELEMENT: - check = ELEMENT_KEYWORDS; - break; - case ISI_ENTITY: - case ISI_NOTATION: - check = NOTATION_KEYWORDS; - break; - default: - check = Collections.emptySet(); - } + check = switch (state) { + case ISI_ATTLIST -> ATTLIST_KEYWORDS; + case ISI_ELEMENT -> ELEMENT_KEYWORDS; + case ISI_ENTITY, ISI_NOTATION -> NOTATION_KEYWORDS; + default -> Collections.emptySet(); + }; if (check.contains(t)) { return tokenFactory.createToken(DTDTokenId.KEYWORD); } else { return tokenFactory.createToken(DTDTokenId.NAME); } } - break; + } } return error(); } - + private Token nextProcessingInstr() { switch (substate) { - case SUB_VALUE_DOUBLE: + case SUB_VALUE_DOUBLE -> { restoreState(); return stringvalue('"'); - case SUB_VALUE_QUOTE: + } + case SUB_VALUE_QUOTE -> { restoreState(); return stringvalue('\''); + } } Token wh = skipWhitespace(); if (wh != null) { @@ -608,24 +611,29 @@ private Token nextProcessingInstr() { } // process escapes to the upper level switch (ch) { - case '?': // NOI18N + case '?' -> { // NOI18N return endProcessingInstruction(); - case '>': // NOI18N + } + case '>' -> { // NOI18N setState(ISI_INIT); return error(); - case '<': // NOI18N + } + case '<' -> { // NOI18N return unterminatedFoundOpen(); - default: - break; + } + default -> { + } } switch (substate) { - case SUB_PROCESSING_TARGET: + case SUB_PROCESSING_TARGET -> { input.backup(1); return nextProcessingTarget(); - case SUB_PROCESSING_CONTENT: + } + case SUB_PROCESSING_CONTENT -> { input.backup(1); return nextProcessingContent(); - case SUB_PROCESSING_XML: + } + case SUB_PROCESSING_XML -> { if (ch == '=') { // NOI18N // operator return tokenFactory.createToken(DTDTokenId.OPERATOR); @@ -638,15 +646,13 @@ private Token nextProcessingInstr() { } else { error(); } - break; + } } return error(); } - - private Token stringvalue(int delimiter) { - int ch; - while ((ch = input.read()) != LexerInput.EOF) { + private Token stringvalue(int delimiter) { + for(int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == delimiter) { restoreState(); return tokenFactory.createToken(DTDTokenId.STRING); @@ -664,11 +670,11 @@ private Token stringvalue(int delimiter) { } if (input.readLength() > 0) { return tokenFactory.createToken(DTDTokenId.STRING); - } + } setState(ISI_INIT); return error(); } - + private Token valueEntityReference() { if (input.readLength() > 1) { // output partial value token @@ -677,16 +683,15 @@ private Token valueEntityReference() { } return processEntityOrCharacterRef(); } - + /** * Skips whitespaces within declaration, produces DTDToken if whitespace * is found. Does not change state / substate. - * @return + * @return */ private Token skipWhitespace() { - int ch; int start = input.readLength(); - while ((ch = input.read()) != LexerInput.EOF) { + for(int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (!Character.isWhitespace(ch)) { input.backup(1); if ((input.readLength() - start) > 0) { @@ -701,21 +706,18 @@ private Token skipWhitespace() { return null; } } - + private boolean isNametokenChar(int c, boolean first) { if (first) { return c == ':' || c == '_' || Character.isLetter(c); } else { - switch (c) { - case ':': case '_': // NOI18N - case '-': case '.': // NOI18N - return true; - default: - return Character.isLetterOrDigit(c); - } + return switch (c) { + case ':', '_', '-', '.' -> true; // NOI18N + default -> Character.isLetterOrDigit(c); + }; } } - + private Token error() { Token t; if (intrSubstate != 0) { @@ -725,11 +727,11 @@ private Token error() { } return t; } - + private Token processName() { int ch; boolean first = true; - while ((ch = input.read()) != LexerInput.EOF) { + for(ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (isNametokenChar(ch, first)) { first = false; } else { @@ -746,7 +748,7 @@ private Token processName() { return error(); } } - + private Token endProcessingInstruction() { // ? was already consumed int ch = input.read(); @@ -758,12 +760,11 @@ private Token endProcessingInstruction() { return error(); } } - + private Token nextProcessingTarget() { - int ch; boolean first = true; - - while ((ch = input.read()) != LexerInput.EOF) { + + for(int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == '?') { // NOI18N if (first) { return nextProcessingContent(); @@ -791,13 +792,13 @@ private Token nextProcessingTarget() { } return tokenFactory.createToken(DTDTokenId.TARGET); } - + + @SuppressWarnings("AssignmentToForLoopParameter") private Token nextProcessingContent() { - int ch; boolean white = false; int whiteStart = -1; - - while ((ch = input.read()) != LexerInput.EOF) { + + for(int ch = input.read(); ch != LexerInput.EOF; ch = input.read()) { if (ch == '?') { if (whiteStart > 0) { return tokenFactory.createToken(DTDTokenId.PI_CONTENT, whiteStart); @@ -833,11 +834,11 @@ private Token nextProcessingContent() { public Object state() { return (state & 0x0f) | ((substate & 0x0f) << 4) | ((intrSubstate & 0xff) << 16); } - + private int saveState() { return (state & 0x0f) | ((substate & 0x0f) << 4); } - + private void restoreState() { if (intrSubstate == 0) { return; @@ -851,7 +852,7 @@ private void restoreState() { @Override public void release() { } - + public DTDLexer(LexerRestartInfo info) { this.input = info.input(); if (info.state() == null) { diff --git a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/attrlist.pass b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/attrlist.pass index 9a245a9b36a5..ca209069946f 100644 --- a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/attrlist.pass +++ b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/attrlist.pass @@ -5,6 +5,7 @@ NAME, WS, OPERATOR, NAME, WS, OPERATOR, WS, NAME, OPERATOR, WS, STRING, WS, NAME NAME, WS, NAME, WS, KEYWORD, WS, NAME, WS, KEYWORD, WS, KEYWORD, WS NAME, WS, KEYWORD, WS, KEYWORD, WS, NAME, WS, KEYWORD, WS, KEYWORD, WS NAME, WS, KEYWORD, WS, KEYWORD, WS, NAME, WS, KEYWORD, WS, KEYWORD, WS -NAME, WS, KEYWORD, WS, OPERATOR, NAME, OPERATOR, NAME, OPERATOR, WS, KEYWORD, WS, SYMBOL, PLAIN +NAME, WS, KEYWORD, WS, OPERATOR, NAME, OPERATOR, NAME, OPERATOR, WS, KEYWORD, WS +NAME, WS, OPERATOR, NAME, WS, OPERATOR, WS, NAME, WS, OPERATOR, WS, KEYWORD, WS, SYMBOL, PLAIN SYMBOL, DECLARATION, WS, REFERENCE, SYMBOL, PLAIN SYMBOL, DECLARATION, WS, NAME, WS, REFERENCE, SYMBOL, PLAIN diff --git a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/comment.pass b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/comment.pass new file mode 100644 index 000000000000..23bfea37db2d --- /dev/null +++ b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/comment.pass @@ -0,0 +1,3 @@ +COMMENT, PLAIN +COMMENT +PLAIN diff --git a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/embeddedEntities.pass b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/embeddedEntities.pass index d4a6981af658..662884b81867 100644 --- a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/embeddedEntities.pass +++ b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/embeddedEntities.pass @@ -11,4 +11,4 @@ SYMBOL, DECLARATION, WS, NAME, WS, STRING, {ERROR}, STRING, SYMBOL, PLAIN SYMBOL, DECLARATION, WS, NAME, WS, STRING, {ERROR}, STRING, SYMBOL, PLAIN SYMBOL, DECLARATION, WS, NAME, WS, ERROR, SYMBOL, PLAIN SYMBOL, DECLARATION, WS, NAME, WS, ERROR, SYMBOL, PLAIN -SYMBOL, DECLARATION, WS, NAME, WS, ERROR, ERROR, ERROR, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, ERROR, NAME, ERROR, SYMBOL, PLAIN diff --git a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/entity.pass b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/entity.pass new file mode 100644 index 000000000000..cb99a4858a39 --- /dev/null +++ b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/entity.pass @@ -0,0 +1,7 @@ +SYMBOL, DECLARATION, WS, NAME, WS, STRING, WS, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, WS, STRING, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, WS, STRING, WS, KEYWORD, WS, NAME, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, OPERATOR, WS, NAME, WS, STRING, WS, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, OPERATOR, WS, NAME, WS, KEYWORD, WS, STRING, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, OPERATOR, WS, NAME, WS, KEYWORD, WS, STRING, WS, STRING, SYMBOL, PLAIN diff --git a/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/notion.pass b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/notion.pass new file mode 100644 index 000000000000..d2ac1a745d41 --- /dev/null +++ b/ide/xml.lexer/test/unit/data/goldenfiles/org/netbeans/api/xml/lexer/notion.pass @@ -0,0 +1,3 @@ +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, WS, STRING, SYMBOL, PLAIN +SYMBOL, DECLARATION, WS, NAME, WS, KEYWORD, WS, STRING, SYMBOL, PLAIN diff --git a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/DTDTokenIdTest.java b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/DTDTokenIdTest.java index ef32d279d26a..c1471a20d653 100644 --- a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/DTDTokenIdTest.java +++ b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/DTDTokenIdTest.java @@ -52,8 +52,8 @@ private String lexDocument(String resourceName) throws Exception { ((AbstractDocument)document).readLock(); try { - TokenHierarchy th = TokenHierarchy.get(document); - TokenSequence ts = th.tokenSequence(); + TokenHierarchy th = TokenHierarchy.get(document); + TokenSequence ts = th.tokenSequence(DTDTokenId.language()); //assert(ts.tokenCount() == expectedIds.length); int overLine = 0; while(ts.moveNext()) { @@ -101,16 +101,21 @@ private void checkTokenSequence(String resource) throws Exception { String path = getClass().getName(); path = path.substring(0, path.lastIndexOf('.')).replace('.', '/'); - FileObject w = FileUtil.toFileObject(getWorkDir()).createData(resource + ".out"); - File g = new File(getDataDir(), "goldenfiles/" + path + "/" + resource + ".pass"); - try (OutputStream o = w.getOutputStream(); + FileObject testOutput = FileUtil.toFileObject(getWorkDir()).createData(resource + ".out"); + File goldenFile = new File(getDataDir(), "goldenfiles/" + path + "/" + resource + ".pass"); + try (OutputStream o = testOutput.getOutputStream(); OutputStreamWriter wr = new OutputStreamWriter(o)) { wr.write(text); } - File d = new File(getWorkDir(), resource + ".diff"); - assertFile(FileUtil.toFile(w), g, d); + File diffFile = new File(getWorkDir(), resource + ".diff"); + assertFile(FileUtil.toFile(testOutput), goldenFile, diffFile); } + @Override + protected Language getLanguage() { + return DTDTokenId.language(); + } + public void testXMLDeclaration() throws Exception { checkTokenSequence("textDeclarations"); } @@ -123,16 +128,19 @@ public void testAttrlist() throws Exception { checkTokenSequence("attrlist"); } - @Override - protected Language getLanguage() { - return DTDTokenId.language(); - } - public void testEmbeddedEntityRefs() throws Exception { checkTokenSequence("embeddedEntities"); } - + public void testComments() throws Exception { - + checkTokenSequence("comment"); + } + + public void testNotions() throws Exception { + checkTokenSequence("notion"); + } + + public void testEntities() throws Exception { + checkTokenSequence("entity"); } } diff --git a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/attrlist.dtd b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/attrlist.dtd index 4c0f6ba72b2e..5049b523b487 100644 --- a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/attrlist.dtd +++ b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/attrlist.dtd @@ -5,6 +5,7 @@ entities ENTITIES #IMPLIED id ID #IMPLIED idref IDREF #IMPLIED idrefs IDREFS #IMPLIED nmtoken NMTOKEN #IMPLIED nmtokens NMTOKENS #IMPLIED - notation NOTATION (pdf|dvi) #IMPLIED > + notation NOTATION (pdf|dvi) #IMPLIED + year (2025 | 2026 ) #REQUIRED > diff --git a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/comment.dtd b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/comment.dtd new file mode 100644 index 000000000000..2d210496469d --- /dev/null +++ b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/comment.dtd @@ -0,0 +1,4 @@ + + diff --git a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/entity.dtd b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/entity.dtd new file mode 100644 index 000000000000..e1281ad9420f --- /dev/null +++ b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/entity.dtd @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/notion.dtd b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/notion.dtd new file mode 100644 index 000000000000..7257f5bc4d41 --- /dev/null +++ b/ide/xml.lexer/test/unit/src/org/netbeans/api/xml/lexer/resources/notion.dtd @@ -0,0 +1,3 @@ + + + diff --git a/ide/xml.text/build.xml b/ide/xml.text/build.xml index 7be4d7894ba3..904e30504140 100644 --- a/ide/xml.text/build.xml +++ b/ide/xml.text/build.xml @@ -21,4 +21,16 @@ --> + + + + + + + + + + diff --git a/ide/xml.text/external/binaries-list b/ide/xml.text/external/binaries-list new file mode 100644 index 000000000000..10e430c45095 --- /dev/null +++ b/ide/xml.text/external/binaries-list @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +7EFCA479324AD44EB42433EC61D365C46776474C net.java.dev.javacc:javacc:7.0.10 diff --git a/ide/xml.text/external/javacc-7.0.10-license.txt b/ide/xml.text/external/javacc-7.0.10-license.txt new file mode 100644 index 000000000000..35af67dbacf7 --- /dev/null +++ b/ide/xml.text/external/javacc-7.0.10-license.txt @@ -0,0 +1,34 @@ +Name: JavaCC +Version: 7.0.10 +Description: Parser generator for SQL parser. +Origin: https://github.com/javacc/javacc/ +OSR: 3106 +License: BSD-javacc-7.0.10 +Type: compile-time + +Copyright (c) 2006, Sun Microsystems, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Sun Microsystems, Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntax.jj b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntax.jj index 4dd26e14c95c..88bc8b193184 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntax.jj +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntax.jj @@ -54,14 +54,13 @@ options { // USER_CHAR_STREAM = true; UNICODE_INPUT = true; // generate unicode aware code - OPTIMIZE_TOKEN_MANAGER = true; BUILD_PARSER = false; STATIC = false; } PARSER_BEGIN(DTDSyntax) -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntaxConstants.java b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntaxConstants.java index d55c998453bf..74942a445955 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntaxConstants.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/DTDSyntaxConstants.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. DTDSyntaxConstants.java */ -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -20,103 +20,202 @@ package org.netbeans.modules.xml.text.syntax.javacc; + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ public interface DTDSyntaxConstants { + /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int CRLF = 1; + /** RegularExpression Id. */ int TEXT = 2; + /** RegularExpression Id. */ int CONTENT = 3; + /** RegularExpression Id. */ int WS = 4; + /** RegularExpression Id. */ int DECL_START = 5; + /** RegularExpression Id. */ int PI_START = 6; + /** RegularExpression Id. */ int TEXT_IN_DEFAULT = 7; + /** RegularExpression Id. */ int COND_END_IN_DEFAULT = 8; + /** RegularExpression Id. */ int ERR_IN_DEFAULT = 9; + /** RegularExpression Id. */ int XML_TARGET = 10; + /** RegularExpression Id. */ int PI_TARGET = 11; + /** RegularExpression Id. */ int ERR_IN_PI = 12; + /** RegularExpression Id. */ int PI_CONTENT_START = 13; + /** RegularExpression Id. */ int PI_END = 14; + /** RegularExpression Id. */ int KW_IN_XML_DECL = 15; + /** RegularExpression Id. */ int TEXT_IN_XML_DECL = 16; + /** RegularExpression Id. */ int BR_IN_XML_DECL = 17; + /** RegularExpression Id. */ int XML_DECL_END = 18; + /** RegularExpression Id. */ int Q_IN_XML_DECL = 19; + /** RegularExpression Id. */ int TEXT_IN_PI_CONTENT = 20; + /** RegularExpression Id. */ int ERR_IN_PI_CONTENT = 21; + /** RegularExpression Id. */ int PI_CONTENT_END = 22; + /** RegularExpression Id. */ int BR_IN_PI_CONTENT = 23; + /** RegularExpression Id. */ int ENTITY = 24; + /** RegularExpression Id. */ int ATTLIST = 25; + /** RegularExpression Id. */ int DOCTYPE = 26; + /** RegularExpression Id. */ int ELEMENT = 27; + /** RegularExpression Id. */ int NOTATION = 28; + /** RegularExpression Id. */ int TEXT_IN_DECL = 29; + /** RegularExpression Id. */ int WS_IN_DECL = 30; + /** RegularExpression Id. */ int ERR_IN_DECL = 31; + /** RegularExpression Id. */ int COND = 32; + /** RegularExpression Id. */ int DECL_END = 33; + /** RegularExpression Id. */ int KW_IN_ENTITY = 34; + /** RegularExpression Id. */ int BR_IN_ENTITY = 35; + /** RegularExpression Id. */ int TEXT_IN_ENTITY = 36; + /** RegularExpression Id. */ int ENTITY_END = 37; + /** RegularExpression Id. */ int KW_IN_ELEMENT = 38; + /** RegularExpression Id. */ int SYMBOL_IN_ELEMENT = 39; + /** RegularExpression Id. */ int TEXT_IN_ELEMENT = 40; + /** RegularExpression Id. */ int ELEMENT_END = 41; + /** RegularExpression Id. */ int KW_IN_NOTATION = 42; + /** RegularExpression Id. */ int TEXT_IN_NOTATION = 43; + /** RegularExpression Id. */ int BR_IN_NOTATION = 44; + /** RegularExpression Id. */ int NOTATION_END = 45; + /** RegularExpression Id. */ int KW_IN_COND = 46; + /** RegularExpression Id. */ int TEXT_IN_COND = 47; + /** RegularExpression Id. */ int ERR_IN_COND = 48; + /** RegularExpression Id. */ int COND_END = 49; + /** RegularExpression Id. */ int ERR_IN_ATTLIST = 50; + /** RegularExpression Id. */ int KW_IN_ATTLIST = 51; + /** RegularExpression Id. */ int TEXT_IN_ATTLIST = 52; + /** RegularExpression Id. */ int ATTLIST_END = 53; + /** RegularExpression Id. */ int PREF_START = 54; + /** RegularExpression Id. */ int TEXT_IN_PREF = 55; + /** RegularExpression Id. */ int PREF_END = 56; + /** RegularExpression Id. */ int CHARS_START = 57; + /** RegularExpression Id. */ int TEXT_IN_CHARS = 58; + /** RegularExpression Id. */ int CHARS_END = 59; + /** RegularExpression Id. */ int STRING_START = 60; + /** RegularExpression Id. */ int TEXT_IN_STRING = 61; + /** RegularExpression Id. */ int STRING_END = 62; + /** RegularExpression Id. */ int COMMENT_START = 63; + /** RegularExpression Id. */ int TEXT_IN_COMMENT = 64; + /** RegularExpression Id. */ int ERR_IN_COMMENT = 65; + /** RegularExpression Id. */ int COMMENT_END = 66; + /** RegularExpression Id. */ int CHREF_START = 67; + /** RegularExpression Id. */ int CREF_START = 68; + /** RegularExpression Id. */ int TEXT_IN_CREF = 69; + /** RegularExpression Id. */ int CREF_END = 70; + /** RegularExpression Id. */ int ERR_IN_CREF = 71; + /** RegularExpression Id. */ int TEXT_IN_CHREF = 72; + /** RegularExpression Id. */ int CHREF_END = 73; + /** RegularExpression Id. */ int ERR_IN_CHREF = 74; + /** Lexical state. */ int IN_CHREF = 0; + /** Lexical state. */ int IN_CREF = 1; + /** Lexical state. */ int IN_COMMENT = 2; + /** Lexical state. */ int IN_STRING = 3; + /** Lexical state. */ int IN_CHARS = 4; + /** Lexical state. */ int IN_DOCTYPE = 5; + /** Lexical state. */ int IN_TAG_ATTLIST = 6; + /** Lexical state. */ int IN_PREF = 7; + /** Lexical state. */ int IN_ATTLIST = 8; + /** Lexical state. */ int IN_COND = 9; + /** Lexical state. */ int IN_NOTATION = 10; + /** Lexical state. */ int IN_ELEMENT = 11; + /** Lexical state. */ int IN_ENTITY = 12; + /** Lexical state. */ int IN_DECL = 13; + /** Lexical state. */ int IN_PI_CONTENT = 14; + /** Lexical state. */ int IN_XML_DECL = 15; + /** Lexical state. */ int IN_PI = 16; + /** Lexical state. */ int DEFAULT = 17; + /** Literal token values. */ String[] tokenImage = { "", "\"\\n\"", diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/ParseException.java b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/ParseException.java index cf7eb7c62dfd..2405274cc68f 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/ParseException.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/ParseException.java @@ -1,5 +1,6 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -/** +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 7.0 */ +/* JavaCCOptions:KEEP_LINE_COLUMN=true */ +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -31,25 +32,30 @@ */ public class ParseException extends Exception { + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * The end of line string for this machine. + */ + protected static String EOL = System.getProperty("line.separator", "\n"); + /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: + * "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { - super(""); - specialConstructor = true; + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; @@ -67,25 +73,18 @@ public ParseException(Token currentTokenVal, public ParseException() { super(); - specialConstructor = false; } + /** Constructor with message. */ public ParseException(String message) { super(message); - specialConstructor = false; } - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. + * following this token will (therefore) be the first error token. */ public Token currentToken; @@ -104,32 +103,29 @@ public ParseException(String message) { public String[] tokenImage; /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse + * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message + * from the parser) the correct error message * gets displayed. */ - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } - String expected = ""; + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + + StringBuilder expected = new StringBuilder(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { - expected += tokenImage[expectedTokenSequences[i][j]] + " "; + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { - expected += "..."; + expected.append("..."); } - expected += eol + " "; + expected.append(EOL).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; @@ -139,38 +135,44 @@ public String getMessage() { retval += tokenImage[0]; break; } + retval += " " + tokenImage[tok.kind]; + retval += " \""; retval += add_escapes(tok.image); - tok = tok.next; + retval += " \""; + tok = tok.next; } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; + if (currentToken.next != null) { + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + } + retval += "." + EOL; + + + if (expectedTokenSequences.length == 0) { + // Nothing to add here } else { - retval += "Was expecting one of:" + eol + " "; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + EOL + " "; + } else { + retval += "Was expecting one of:" + EOL + " "; + } + retval += expected.toString(); } - retval += expected; + return retval; } - /** - * The end of line string for this machine. - */ - protected String eol = System.getProperty("line.separator", "\n"); - + /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ - protected String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); + static String add_escapes(String str) { + StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { - case 0 : - continue; case '\b': retval.append("\\b"); continue; @@ -198,7 +200,7 @@ protected String add_escapes(String str) { default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4)); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } @@ -209,3 +211,4 @@ protected String add_escapes(String str) { } } +/* JavaCC - OriginalChecksum=f449d1502dfb23f638ce044b6fbc86b2 (do not edit this line) */ diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/Token.java b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/Token.java index 3798d55180c0..c443e55a0733 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/Token.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/Token.java @@ -1,5 +1,6 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -/** +/* Generated By:JavaCC: Do not edit this line. Token.java Version 7.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COLUMN=true,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -24,7 +25,14 @@ * Describes the input token stream. */ -public class Token { +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering @@ -33,12 +41,14 @@ public class Token { */ public int kind; - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; /** * The string image of the token. @@ -69,12 +79,47 @@ public class Token { */ public Token specialToken; + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + /** * Returns the image. */ + @Override public String toString() { - return image; + return image; } /** @@ -82,19 +127,25 @@ public String toString() * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : + * you want to create if ofKind is ID, simply add something like : * - * case MyParserConstants.ID : return new IDToken(); + * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. + * variable to the appropriate type and use sit in your lexical actions. */ - public static final Token newToken(int ofKind) + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) { - switch(ofKind) - { - default : return new Token(); - } + return newToken(ofKind, null); } } +/* JavaCC - OriginalChecksum=388604111cc51b4d99190ab27c89a04e (do not edit this line) */ diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/TokenMgrError.java b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/TokenMgrError.java index 229af639222e..eb3a7e201fb7 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/TokenMgrError.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/TokenMgrError.java @@ -1,5 +1,6 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -/** +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 7.0 */ +/* JavaCCOptions: */ +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -20,133 +21,146 @@ package org.netbeans.modules.xml.text.syntax.javacc; +/** Token Manager Error. */ public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** - * Lexical error occured. - */ - static final int LEXICAL_ERROR = 0; - - /** - * An attempt wass made to create a second instance of a static token manager. - */ - static final int STATIC_LEXER_ERROR = 1; - - /** - * Tried to change to an invalid lexical state. - */ - static final int INVALID_LEXICAL_STATE = 2; - - /** - * Detected (and bailed out of) an infinite loop in the token manager. - */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - */ - protected static final String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) - { - case 0 : - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u" + s.substring(s.length() - 4)); - } else { - retval.append(ch); - } - continue; - } + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + public static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + public static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + public static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + public static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuilder retval = new StringBuilder(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; } - return retval.toString(); - } - - /** - * Returns a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - * Parameters : - * EOFSeen : indicates if EOF caused the lexicl error - * curLexState : lexical state in which this error occured - * errorLine : line number when the error occured - * errorColumn : column number when the error occured - * errorAfter : prefix that was seen before this error occured - * curchar : the offending character - * Note: You can customize the lexical error message by modifying this method. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * - * "Internal Error : Please file a bug report .... " - * - * from this method for such cases in the release version of your parser. - */ - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalErr(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar) { + char curChar1 = (char)curChar; + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar1)) + "\"") + " (" + curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + @Override + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, int curChar, int reason) { + this(LexicalErr(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } } +/* JavaCC - OriginalChecksum=181a3c74a2ad493079766bfbfb1997d5 (do not edit this line) */ diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntax.jj b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntax.jj index b4a005eced45..c94095755f58 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntax.jj +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntax.jj @@ -60,7 +60,7 @@ options { PARSER_BEGIN(XMLSyntax) -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntaxConstants.java b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntaxConstants.java index 91a840eb5a4e..4622391216ae 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntaxConstants.java +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/XMLSyntaxConstants.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. XMLSyntaxConstants.java */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,252 +17,389 @@ * specific language governing permissions and limitations * under the License. */ + package org.netbeans.modules.xml.text.syntax.javacc; + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ public interface XMLSyntaxConstants { + /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int TEXT = 1; + /** RegularExpression Id. */ int CONTENT = 2; + /** RegularExpression Id. */ int WS = 3; + /** RegularExpression Id. */ int S = 4; + /** RegularExpression Id. */ int NAME = 5; + /** RegularExpression Id. */ int RSB = 6; + /** RegularExpression Id. */ int TAG_START = 7; + /** RegularExpression Id. */ int DECL_START = 8; + /** RegularExpression Id. */ int PI_START = 9; + /** RegularExpression Id. */ int CDATA_START = 10; + /** RegularExpression Id. */ int COND_END_IN_DEFAULT = 11; + /** RegularExpression Id. */ int DTD_END_IN_DEFAULT = 12; + /** RegularExpression Id. */ int TEXT_IN_DEFAULT = 13; + /** RegularExpression Id. */ int ERR_IN_DEFAULT = 14; + /** RegularExpression Id. */ int TAG_NAME = 15; + /** RegularExpression Id. */ int ERR_IN_TAG = 16; + /** RegularExpression Id. */ int ATT_NAME = 17; + /** RegularExpression Id. */ int ERR_IN_TAG_ATTLIST = 18; + /** RegularExpression Id. */ int WS_IN_TAG_ATTLIST = 19; + /** RegularExpression Id. */ int EQ_IN_TAG_ATTLIST = 20; + /** RegularExpression Id. */ int TAG_END = 21; + /** RegularExpression Id. */ int XML_TARGET = 22; + /** RegularExpression Id. */ int PI_CONTENT_START = 23; + /** RegularExpression Id. */ int PI_END = 24; + /** RegularExpression Id. */ int ERR_IN_PI = 25; + /** RegularExpression Id. */ int PI_TARGET = 26; + /** RegularExpression Id. */ int PI_CONTENT_END = 27; + /** RegularExpression Id. */ int TEXT_IN_PI_CONTENT = 28; + /** RegularExpression Id. */ int ERR_IN_PI_CONTENT = 29; + /** RegularExpression Id. */ int KW_IN_XML_DECL = 30; + /** RegularExpression Id. */ int TEXT_IN_XML_DECL = 31; + /** RegularExpression Id. */ int BR_IN_XML_DECL = 32; + /** RegularExpression Id. */ int XML_DECL_END = 33; + /** RegularExpression Id. */ int Q_IN_XML_DECL = 34; + /** RegularExpression Id. */ int CDATA_END = 35; + /** RegularExpression Id. */ int TEXT_IN_CDATA = 36; + /** RegularExpression Id. */ int MARKUP_IN_CDATA = 37; + /** RegularExpression Id. */ int CDATA_CONTENT = 38; + /** RegularExpression Id. */ int ENTITY = 39; + /** RegularExpression Id. */ int ATTLIST = 40; + /** RegularExpression Id. */ int DOCTYPE = 41; + /** RegularExpression Id. */ int ELEMENT = 42; + /** RegularExpression Id. */ int NOTATION = 43; + /** RegularExpression Id. */ int TEXT_IN_DECL = 44; + /** RegularExpression Id. */ int WS_IN_DECL = 45; + /** RegularExpression Id. */ int ERR_IN_DECL = 46; + /** RegularExpression Id. */ int COND = 47; + /** RegularExpression Id. */ int DECL_END = 48; + /** RegularExpression Id. */ int KW_IN_ENTITY = 49; + /** RegularExpression Id. */ int TEXT_IN_ENTITY = 50; + /** RegularExpression Id. */ int ENTITY_END = 51; + /** RegularExpression Id. */ int EMPTY = 52; + /** RegularExpression Id. */ int PCDATA = 53; + /** RegularExpression Id. */ int ANY = 54; + /** RegularExpression Id. */ int TEXT_IN_ELEMENT = 55; + /** RegularExpression Id. */ int ELEMENT_END = 56; + /** RegularExpression Id. */ int SYSTEM_IN_NOTATION = 57; + /** RegularExpression Id. */ int TEXT_IN_NOTATION = 58; + /** RegularExpression Id. */ int ERR_IN_NOTATION = 59; + /** RegularExpression Id. */ int NOTATION_END = 60; + /** RegularExpression Id. */ int INCLUDE = 61; + /** RegularExpression Id. */ int IGNORE = 62; + /** RegularExpression Id. */ int TEXT_IN_COND = 63; + /** RegularExpression Id. */ int ERR_IN_COND = 64; + /** RegularExpression Id. */ int COND_END = 65; + /** RegularExpression Id. */ int ERR_IN_ATTLIST = 66; + /** RegularExpression Id. */ int REQUIRED = 67; + /** RegularExpression Id. */ int IMPLIED = 68; + /** RegularExpression Id. */ int FIXED = 69; + /** RegularExpression Id. */ int ID_IN_ATTLIST = 70; + /** RegularExpression Id. */ int CDATA = 71; + /** RegularExpression Id. */ int IDREF = 72; + /** RegularExpression Id. */ int IDREFS = 73; + /** RegularExpression Id. */ int ENTITY_IN_ATTLIST = 74; + /** RegularExpression Id. */ int ENTITIES = 75; + /** RegularExpression Id. */ int NMTOKEN = 76; + /** RegularExpression Id. */ int NMTOKENS = 77; + /** RegularExpression Id. */ int NOTATION_IN_ATTLIST = 78; + /** RegularExpression Id. */ int TEXT_IN_ATTLIST = 79; + /** RegularExpression Id. */ int ATTLIST_END = 80; + /** RegularExpression Id. */ int PUBLIC = 81; + /** RegularExpression Id. */ int SYSTEM = 82; + /** RegularExpression Id. */ int TEXT_IN_DOCTYPE = 83; + /** RegularExpression Id. */ int ERR_IN_DOCTYPE = 84; + /** RegularExpression Id. */ int DOCTYPE_END = 85; + /** RegularExpression Id. */ int PREF_START = 86; + /** RegularExpression Id. */ int TEXT_IN_PREF = 87; + /** RegularExpression Id. */ int PREF_END = 88; + /** RegularExpression Id. */ int GREF_START = 89; + /** RegularExpression Id. */ int TEXT_IN_GREF = 90; + /** RegularExpression Id. */ int ERR_IN_GREF = 91; + /** RegularExpression Id. */ int GREF_END = 92; + /** RegularExpression Id. */ int CHARS_START = 93; + /** RegularExpression Id. */ int TEXT_IN_CHARS = 94; + /** RegularExpression Id. */ int CHARS_END = 95; + /** RegularExpression Id. */ int GREF_CHARS_START = 96; + /** RegularExpression Id. */ int TEXT_IN_GREF_CHARS = 97; + /** RegularExpression Id. */ int GREF_CHARS_END = 98; + /** RegularExpression Id. */ int STRING_START = 99; + /** RegularExpression Id. */ int TEXT_IN_STRING = 100; + /** RegularExpression Id. */ int STRING_END = 101; + /** RegularExpression Id. */ int GREF_STRING_START = 102; + /** RegularExpression Id. */ int TEXT_IN_GREF_STRING = 103; + /** RegularExpression Id. */ int GREF_STRING_END = 104; + /** RegularExpression Id. */ int COMMENT_START = 105; + /** RegularExpression Id. */ int TEXT_IN_COMMENT = 106; + /** RegularExpression Id. */ int ERR_IN_COMMENT = 107; + /** RegularExpression Id. */ int COMMENT_END = 108; + /** Lexical state. */ int IN_COMMENT = 0; + /** Lexical state. */ int IN_STRING = 1; + /** Lexical state. */ int IN_CHARS = 2; + /** Lexical state. */ int IN_GREF = 3; + /** Lexical state. */ int IN_GREF_STRING = 4; + /** Lexical state. */ int IN_GREF_CHARS = 5; + /** Lexical state. */ int IN_PREF = 6; + /** Lexical state. */ int IN_DOCTYPE = 7; + /** Lexical state. */ int IN_ATTLIST_DECL = 8; + /** Lexical state. */ int IN_COND = 9; + /** Lexical state. */ int IN_NOTATION = 10; + /** Lexical state. */ int IN_ELEMENT = 11; + /** Lexical state. */ int IN_ENTITY_DECL = 12; + /** Lexical state. */ int IN_DECL = 13; + /** Lexical state. */ int IN_CDATA = 14; + /** Lexical state. */ int IN_XML_DECL = 15; + /** Lexical state. */ int IN_PI_CONTENT = 16; + /** Lexical state. */ int IN_PI = 17; + /** Lexical state. */ int IN_TAG_ATTLIST = 18; + /** Lexical state. */ int IN_TAG = 19; + /** Lexical state. */ int DEFAULT = 20; + /** Literal token values. */ String[] tokenImage = { - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"]\"", // NOI18N - "\"<\"", // NOI18N - "\"\"", // NOI18N - "\"]>\"", // NOI18N - "", // NOI18N - "\"<<\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"=\"", // NOI18N - "", // NOI18N - "\"xml\"", // NOI18N - "", // NOI18N - "\"?>\"", // NOI18N - "", // NOI18N - "", // NOI18N - "\"?>\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"?>\"", // NOI18N - "\"?\"", // NOI18N - "\"]]>\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"ENTITY\"", // NOI18N - "\"ATTLIST\"", // NOI18N - "\"DOCTYPE\"", // NOI18N - "\"ELEMENT\"", // NOI18N - "\"NOTATION\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"[\"", // NOI18N - "\">\"", // NOI18N - "", // NOI18N - "", // NOI18N - "\">\"", // NOI18N - "\"EMPTY\"", // NOI18N - "\"#PCDATA\"", // NOI18N - "\"ANY\"", // NOI18N - "", // NOI18N - "\">\"", // NOI18N - "", // NOI18N - "", // NOI18N - "\"<\"", // NOI18N - "\">\"", // NOI18N - "\"INCLUDE\"", // NOI18N - "\"IGNORE\"", // NOI18N - "", // NOI18N - "", // NOI18N - "\"[\"", // NOI18N - "", // NOI18N - "\"#REQUIRED\"", // NOI18N - "\"#IMPLIED\"", // NOI18N - "\"#FIXED\"", // NOI18N - "\"ID\"", // NOI18N - "\"CDATA\"", // NOI18N - "\"IDREF\"", // NOI18N - "\"IDREFS\"", // NOI18N - "\"ENTITY\"", // NOI18N - "\"ENTITIES\"", // NOI18N - "\"NMTOKEN\"", // NOI18N - "\"NMTOKENS\"", // NOI18N - "\"NOTATION\"", // NOI18N - "", // NOI18N - "\">\"", // NOI18N - "\"PUBLIC\"", // NOI18N - "\"SYSTEM\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"%\"", // NOI18N - "", // NOI18N - "", // NOI18N - "\"&\"", // NOI18N - "", // NOI18N - "", // NOI18N - "", // NOI18N - "\"\\\'\"", // NOI18N - "", // NOI18N - "\"\\\'\"", // NOI18N - "\"\\\'\"", // NOI18N - "", // NOI18N - "\"\\\'\"", // NOI18N - "\"\\\"\"", // NOI18N - "", // NOI18N - "\"\\\"\"", // NOI18N - "\"\\\"\"", // NOI18N - "", // NOI18N - "\"\\\"\"", // NOI18N - "\"\"", // NOI18N + "", + "", + "", + "", + "", + "", + "\"]\"", + "\"<\"", + "\"\"", + "\"]>\"", + "", + "\"<<\"", + "", + "", + "", + "", + "", + "\"=\"", + "", + "\"xml\"", + "", + "\"?>\"", + "", + "", + "\"?>\"", + "", + "", + "", + "", + "", + "\"?>\"", + "\"?\"", + "\"]]>\"", + "", + "", + "", + "\"ENTITY\"", + "\"ATTLIST\"", + "\"DOCTYPE\"", + "\"ELEMENT\"", + "\"NOTATION\"", + "", + "", + "", + "\"[\"", + "\">\"", + "", + "", + "\">\"", + "\"EMPTY\"", + "\"#PCDATA\"", + "\"ANY\"", + "", + "\">\"", + "", + "", + "\"<\"", + "\">\"", + "\"INCLUDE\"", + "\"IGNORE\"", + "", + "", + "\"[\"", + "", + "\"#REQUIRED\"", + "\"#IMPLIED\"", + "\"#FIXED\"", + "\"ID\"", + "\"CDATA\"", + "\"IDREF\"", + "\"IDREFS\"", + "\"ENTITY\"", + "\"ENTITIES\"", + "\"NMTOKEN\"", + "\"NMTOKENS\"", + "\"NOTATION\"", + "", + "\">\"", + "\"PUBLIC\"", + "\"SYSTEM\"", + "", + "", + "", + "\"%\"", + "", + "", + "\"&\"", + "", + "", + "", + "\"\\\'\"", + "", + "\"\\\'\"", + "\"\\\'\"", + "", + "\"\\\'\"", + "\"\\\"\"", + "", + "\"\\\"\"", + "\"\\\"\"", + "", + "\"\\\"\"", + "\"\"", }; } diff --git a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/package.html b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/package.html index 387d5ecd9410..f81b36cc09c1 100644 --- a/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/package.html +++ b/ide/xml.text/src/org/netbeans/modules/xml/text/syntax/javacc/package.html @@ -20,22 +20,22 @@ -->

How to use this package

-All Java code in this package is generated using JavaCC tool -from .jj files. It used to exist at -Metamata WWW pages. +

+ All Java code in this package is generated using JavaCC tool + from .jj files. +

-Developer needs to postprocess generated files by erasing -all generated *Stream classes and sources. All .jj -grammars import lib subpackage which contains proper -implementation of these interfaces/classes. + The generated java code can be regenerated by running the + javacc-syntax target. +

-This solution is not clean but current JavaCC and editor module does not -support better solution. Look for lexer.netbeans.org -that should provide stream based lexical analysis for editor that is more -suitable for JavaCC generated code. + This solution is not clean but current JavaCC and editor module does not + support better solution. Look for lexer.netbeans.org + that should provide stream based lexical analysis for editor that is more + suitable for JavaCC generated code.

-XMLSyntax uses more general state stack than DTDSyntax integer array. -(It can be easily copy pasted to DTDSyntax shared text section.) + XMLSyntax uses more general state stack than DTDSyntax integer array. + (It can be easily copy pasted to DTDSyntax shared text section.) diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps index 487d3ec19439..70a440849945 100644 --- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps +++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ignored-overlaps @@ -129,4 +129,7 @@ enterprise/web.jspparser/external/jakarta.servlet.jsp.jstl-3.0.1.jar enterprise/ enterprise/web.jspparser/external/commons-logging-1.3.1.jar platform/o.apache.commons.logging/external/commons-logging-1.3.1.jar # JFlex is used as scanner generator only and is not distributed -webcommon/javascript2.jade/external/jflex-1.4.3.jar php/php.editor/external/jflex-1.4.3.jar \ No newline at end of file +webcommon/javascript2.jade/external/jflex-1.4.3.jar php/php.editor/external/jflex-1.4.3.jar + +# JavaCC is used as lexer/parser generator only and is not distributed +ide/db.sql.visualeditor/external/javacc-7.0.10.jar ide/xml.text/external/javacc-7.0.10.jar \ No newline at end of file