diff options
Diffstat (limited to 'tool/src/org/antlr/v4/tool')
45 files changed, 199 insertions, 63 deletions
diff --git a/tool/src/org/antlr/v4/tool/ANTLRMessage.java b/tool/src/org/antlr/v4/tool/ANTLRMessage.java index 0ed03d6..cf585cb 100644 --- a/tool/src/org/antlr/v4/tool/ANTLRMessage.java +++ b/tool/src/org/antlr/v4/tool/ANTLRMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ANTLRToolListener.java b/tool/src/org/antlr/v4/tool/ANTLRToolListener.java index 5662b34..3aa89e4 100644 --- a/tool/src/org/antlr/v4/tool/ANTLRToolListener.java +++ b/tool/src/org/antlr/v4/tool/ANTLRToolListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/Alternative.java b/tool/src/org/antlr/v4/tool/Alternative.java index f47543c..2a993c2 100644 --- a/tool/src/org/antlr/v4/tool/Alternative.java +++ b/tool/src/org/antlr/v4/tool/Alternative.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/Attribute.java b/tool/src/org/antlr/v4/tool/Attribute.java index 94baaa6..5e15c01 100644 --- a/tool/src/org/antlr/v4/tool/Attribute.java +++ b/tool/src/org/antlr/v4/tool/Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/AttributeDict.java b/tool/src/org/antlr/v4/tool/AttributeDict.java index 6513f9b..2af27f6 100644 --- a/tool/src/org/antlr/v4/tool/AttributeDict.java +++ b/tool/src/org/antlr/v4/tool/AttributeDict.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/AttributeResolver.java b/tool/src/org/antlr/v4/tool/AttributeResolver.java index e581f23..18dd9ef 100644 --- a/tool/src/org/antlr/v4/tool/AttributeResolver.java +++ b/tool/src/org/antlr/v4/tool/AttributeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java b/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java index be48bfa..c33aa4d 100644 --- a/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java +++ b/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/DOTGenerator.java b/tool/src/org/antlr/v4/tool/DOTGenerator.java index 6f7aaea..062f2da 100644 --- a/tool/src/org/antlr/v4/tool/DOTGenerator.java +++ b/tool/src/org/antlr/v4/tool/DOTGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -92,7 +92,7 @@ public class DOTGenerator { if ( target.stateNumber == Integer.MAX_VALUE ) continue; int ttype = i-1; // we shift up for EOF as -1 for parser String label = String.valueOf(ttype); - if ( isLexer ) label = "'"+getEdgeLabel(String.valueOf((char) i))+"'"; + if ( isLexer ) label = "'"+getEdgeLabel(new StringBuilder().appendCodePoint(i).toString())+"'"; else if ( grammar!=null ) label = grammar.getTokenDisplayName(ttype); ST st = stlib.getInstanceOf("edge"); st.add("label", label); @@ -259,7 +259,7 @@ public class DOTGenerator { edgeST = stlib.getInstanceOf("edge"); AtomTransition atom = (AtomTransition)edge; String label = String.valueOf(atom.label); - if ( isLexer ) label = "'"+getEdgeLabel(String.valueOf((char)atom.label))+"'"; + if ( isLexer ) label = "'"+getEdgeLabel(new StringBuilder().appendCodePoint(atom.label).toString())+"'"; else if ( grammar!=null ) label = grammar.getTokenDisplayName(atom.label); edgeST.add("label", getEdgeLabel(label)); } @@ -289,7 +289,8 @@ public class DOTGenerator { edgeST.add("arrowhead", arrowhead); if (s.getNumberOfTransitions() > 1) { edgeST.add("transitionIndex", i); - } else { + } + else { edgeST.add("transitionIndex", false); } dot.add("edges", edgeST); diff --git a/tool/src/org/antlr/v4/tool/DefaultToolListener.java b/tool/src/org/antlr/v4/tool/DefaultToolListener.java index 0f64cd0..a2e810b 100644 --- a/tool/src/org/antlr/v4/tool/DefaultToolListener.java +++ b/tool/src/org/antlr/v4/tool/DefaultToolListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ErrorManager.java b/tool/src/org/antlr/v4/tool/ErrorManager.java index 34f0d50..0230d2b 100644 --- a/tool/src/org/antlr/v4/tool/ErrorManager.java +++ b/tool/src/org/antlr/v4/tool/ErrorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -16,7 +16,6 @@ import java.io.File; import java.net.URL; import java.util.Collection; import java.util.EnumSet; -import java.util.Locale; import java.util.Set; public class ErrorManager { @@ -32,8 +31,6 @@ public class ErrorManager { /** The group of templates that represent the current message format. */ STGroup format; - /** Messages should be sensitive to the locale. */ - Locale locale; String formatName; ErrorBuffer initSTListener = new ErrorBuffer(); @@ -63,11 +60,20 @@ public class ErrorManager { locationValid = true; } if (msg.fileName != null) { - File f = new File(msg.fileName); - // Don't show path to file in messages; too long. String displayFileName = msg.fileName; - if ( f.exists() ) { - displayFileName = f.getName(); + if (format.equals("antlr")) { + // Don't show path to file in messages in ANTLR format; + // they're too long. + File f = new File(msg.fileName); + if ( f.exists() ) { + displayFileName = f.getName(); + } + } + else { + // For other message formats, use the full filename in the + // message. This assumes that these formats are intended to + // be parsed by IDEs, and so they need the full path to + // resolve correctly. } locationST.add("file", displayFileName); locationValid = true; diff --git a/tool/src/org/antlr/v4/tool/ErrorSeverity.java b/tool/src/org/antlr/v4/tool/ErrorSeverity.java index 1c527b1..3bc89db 100644 --- a/tool/src/org/antlr/v4/tool/ErrorSeverity.java +++ b/tool/src/org/antlr/v4/tool/ErrorSeverity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ErrorType.java b/tool/src/org/antlr/v4/tool/ErrorType.java index c4a3861..a034803 100644 --- a/tool/src/org/antlr/v4/tool/ErrorType.java +++ b/tool/src/org/antlr/v4/tool/ErrorType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -394,11 +394,11 @@ public enum ErrorType { */ IMPORT_NAME_CLASH(113, "<arg.typeString> grammar <arg.name> and imported <arg2.typeString> grammar <arg2.name> both generate <arg2.recognizerName>", ErrorSeverity.ERROR), /** - * Compiler Error 160. + * Compiler Error 114. * * <p>cannot find tokens file <em>filename</em></p> */ - CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR(160, "cannot find tokens file <arg>", ErrorSeverity.ERROR), + CANNOT_FIND_TOKENS_FILE_REFD_IN_GRAMMAR(114, "cannot find tokens file <arg>", ErrorSeverity.ERROR), /** * Compiler Warning 118. * @@ -522,7 +522,7 @@ public enum ErrorType { */ USE_OF_BAD_WORD(134, "symbol <arg> conflicts with generated code in target language or runtime", ErrorSeverity.ERROR), /** - * Compiler Error 134. + * Compiler Error 183. * * <p>rule reference <em>rule</em> is not currently supported in a set</p> * @@ -530,7 +530,7 @@ public enum ErrorType { * Note: This error has the same number as the unrelated error * {@link #USE_OF_BAD_WORD}.</p> */ - UNSUPPORTED_REFERENCE_IN_LEXER_SET(134, "rule reference <arg> is not currently supported in a set", ErrorSeverity.ERROR), + UNSUPPORTED_REFERENCE_IN_LEXER_SET(183, "rule reference <arg> is not currently supported in a set", ErrorSeverity.ERROR), /** * Compiler Error 135. * @@ -824,7 +824,7 @@ public enum ErrorType { * * @since 4.2.1 */ - INVALID_ESCAPE_SEQUENCE(156, "invalid escape sequence", ErrorSeverity.ERROR), + INVALID_ESCAPE_SEQUENCE(156, "invalid escape sequence <arg>", ErrorSeverity.WARNING), /** * Compiler Warning 157. * @@ -1043,7 +1043,51 @@ public enum ErrorType { * * TODO: Does not work with fragment rules. */ - CHARACTERS_COLLISION_IN_SET(180, "chars \"<arg>\" used multiple times in set <arg2>", ErrorSeverity.WARNING), + CHARACTERS_COLLISION_IN_SET(180, "chars <arg> used multiple times in set <arg2>", ErrorSeverity.WARNING), + + /** + * Compiler Warning 181 + * + * <p>The token range operator makes no sense in the parser as token types + * are not ordered (except in implementation). + * </p> + * + * <pre> + * grammar T; + * a : 'A'..'Z' ; + * </pre> + * + */ + TOKEN_RANGE_IN_PARSER(181, "token ranges not allowed in parser: <arg>..<arg2>", ErrorSeverity.ERROR), + + /** + * Compiler Error 182. + * + * <p>Unicode properties cannot be part of a lexer charset range</p> + * + * <pre> + * A: [\\p{Letter}-\\p{Number}]; + * </pre> + */ + UNICODE_PROPERTY_NOT_ALLOWED_IN_RANGE( + 182, + "unicode property escapes not allowed in lexer charset range: <arg>", + ErrorSeverity.ERROR), + + /** + * Compiler Warning 184. + * + * <p>The token value overlapped by another token or self</p> + * + * <pre> + * TOKEN1: 'value'; + * TOKEN2: 'value'; // warning + * </pre> + */ + TOKEN_UNREACHABLE( + 184, + "One of the token <arg> values unreachable. <arg2> is always overlapped by token <arg3>", + ErrorSeverity.WARNING), /* * Backward incompatibility errors diff --git a/tool/src/org/antlr/v4/tool/Grammar.java b/tool/src/org/antlr/v4/tool/Grammar.java index ea249f8..b86d622 100644 --- a/tool/src/org/antlr/v4/tool/Grammar.java +++ b/tool/src/org/antlr/v4/tool/Grammar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -81,6 +81,7 @@ public class Grammar implements AttributeResolver { parserOptions.add("TokenLabelType"); parserOptions.add("tokenVocab"); parserOptions.add("language"); + parserOptions.add("accessLevel"); parserOptions.add("exportMacro"); } @@ -1301,7 +1302,11 @@ public class Grammar implements AttributeResolver { char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn); ATN deserialized = new ATNDeserializer().deserialize(serializedAtn); - return new LexerInterpreter(fileName, getVocabulary(), Arrays.asList(getRuleNames()), ((LexerGrammar)this).modes.keySet(), deserialized, input); + List<String> allChannels = new ArrayList<String>(); + allChannels.add("DEFAULT_TOKEN_CHANNEL"); + allChannels.add("HIDDEN"); + allChannels.addAll(channelValueToNameList); + return new LexerInterpreter(fileName, getVocabulary(), Arrays.asList(getRuleNames()), allChannels, ((LexerGrammar)this).modes.keySet(), deserialized, input); } /** @since 4.5.1 */ diff --git a/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java b/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java index 78d1731..1e7db8b 100644 --- a/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java +++ b/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java b/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java index b8cbb77..7123b43 100644 --- a/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java +++ b/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/GrammarSemanticsMessage.java b/tool/src/org/antlr/v4/tool/GrammarSemanticsMessage.java index 3be7c72..802aff7 100644 --- a/tool/src/org/antlr/v4/tool/GrammarSemanticsMessage.java +++ b/tool/src/org/antlr/v4/tool/GrammarSemanticsMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/GrammarSyntaxMessage.java b/tool/src/org/antlr/v4/tool/GrammarSyntaxMessage.java index 6de8861..e3fb5b6 100644 --- a/tool/src/org/antlr/v4/tool/GrammarSyntaxMessage.java +++ b/tool/src/org/antlr/v4/tool/GrammarSyntaxMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java index fa27e7f..f6e4cdf 100644 --- a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java +++ b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -161,6 +161,7 @@ public class GrammarTransformPipeline { GrammarAST id = (GrammarAST) root.getChild(0); GrammarASTAdaptor adaptor = new GrammarASTAdaptor(id.token.getInputStream()); + GrammarAST channelsRoot = (GrammarAST)root.getFirstChildWithType(ANTLRParser.CHANNELS); GrammarAST tokensRoot = (GrammarAST)root.getFirstChildWithType(ANTLRParser.TOKENS_SPEC); List<GrammarAST> actionRoots = root.getNodesWithType(ANTLRParser.AT); @@ -172,7 +173,39 @@ public class GrammarTransformPipeline { List<GrammarAST> rootRules = RULES.getNodesWithType(ANTLRParser.RULE); for (GrammarAST r : rootRules) rootRuleNames.add(r.getChild(0).getText()); + // make list of modes we have in root grammar + List<GrammarAST> rootModes = root.getNodesWithType(ANTLRParser.MODE); + Set<String> rootModeNames = new HashSet<String>(); + for (GrammarAST m : rootModes) rootModeNames.add(m.getChild(0).getText()); + List<GrammarAST> addedModes = new ArrayList<GrammarAST>(); + for (Grammar imp : imports) { + // COPY CHANNELS + GrammarAST imp_channelRoot = (GrammarAST)imp.ast.getFirstChildWithType(ANTLRParser.CHANNELS); + if ( imp_channelRoot != null) { + rootGrammar.tool.log("grammar", "imported channels: "+imp_channelRoot.getChildren()); + if (channelsRoot==null) { + channelsRoot = imp_channelRoot.dupTree(); + channelsRoot.g = rootGrammar; + root.insertChild(1, channelsRoot); // ^(GRAMMAR ID TOKENS...) + } else { + for (int c = 0; c < imp_channelRoot.getChildCount(); ++c) { + String channel = imp_channelRoot.getChild(c).getText(); + boolean channelIsInRootGrammar = false; + for (int rc = 0; rc < channelsRoot.getChildCount(); ++rc) { + String rootChannel = channelsRoot.getChild(rc).getText(); + if (rootChannel.equals(channel)) { + channelIsInRootGrammar = true; + break; + } + } + if (!channelIsInRootGrammar) { + channelsRoot.addChild(imp_channelRoot.getChild(c).dupNode()); + } + } + } + } + // COPY TOKENS GrammarAST imp_tokensRoot = (GrammarAST)imp.ast.getFirstChildWithType(ANTLRParser.TOKENS_SPEC); if ( imp_tokensRoot!=null ) { @@ -242,7 +275,54 @@ public class GrammarTransformPipeline { } } + // COPY MODES + // The strategy is to copy all the mode sections rules across to any + // mode section in the new grammar with the same name or a new + // mode section if no matching mode is resolved. Rules which are + // already in the new grammar are ignored for copy. If the mode + // section being added ends up empty it is not added to the merged + // grammar. + List<GrammarAST> modes = imp.ast.getNodesWithType(ANTLRParser.MODE); + if (modes != null) { + for (GrammarAST m : modes) { + rootGrammar.tool.log("grammar", "imported mode: " + m.toStringTree()); + String name = m.getChild(0).getText(); + boolean rootAlreadyHasMode = rootModeNames.contains(name); + GrammarAST destinationAST = null; + if (rootAlreadyHasMode) { + for (GrammarAST m2 : rootModes) { + if (m2.getChild(0).getText().equals(name)) { + destinationAST = m2; + break; + } + } + } else { + destinationAST = m.dupNode(); + destinationAST.addChild(m.getChild(0).dupNode()); + } + + int addedRules = 0; + List<GrammarAST> modeRules = m.getAllChildrenWithType(ANTLRParser.RULE); + for (GrammarAST r : modeRules) { + rootGrammar.tool.log("grammar", "imported rule: "+r.toStringTree()); + String ruleName = r.getChild(0).getText(); + boolean rootAlreadyHasRule = rootRuleNames.contains(ruleName); + if (!rootAlreadyHasRule) { + destinationAST.addChild(r); + addedRules++; + rootRuleNames.add(ruleName); + } + } + if (!rootAlreadyHasMode && addedRules > 0) { + rootGrammar.ast.addChild(destinationAST); + rootModeNames.add(name); + rootModes.add(destinationAST); + } + } + } + // COPY RULES + // Rules copied in the mode copy phase are not copied again. List<GrammarAST> rules = imp.ast.getNodesWithType(ANTLRParser.RULE); if ( rules!=null ) { for (GrammarAST r : rules) { diff --git a/tool/src/org/antlr/v4/tool/LabelElementPair.java b/tool/src/org/antlr/v4/tool/LabelElementPair.java index aa2b292..a415ef2 100644 --- a/tool/src/org/antlr/v4/tool/LabelElementPair.java +++ b/tool/src/org/antlr/v4/tool/LabelElementPair.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/LabelType.java b/tool/src/org/antlr/v4/tool/LabelType.java index b28cee2..f28f9c5 100644 --- a/tool/src/org/antlr/v4/tool/LabelType.java +++ b/tool/src/org/antlr/v4/tool/LabelType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/LeftRecursionCyclesMessage.java b/tool/src/org/antlr/v4/tool/LeftRecursionCyclesMessage.java index ca1fbc3..9b17abc 100644 --- a/tool/src/org/antlr/v4/tool/LeftRecursionCyclesMessage.java +++ b/tool/src/org/antlr/v4/tool/LeftRecursionCyclesMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java b/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java index fb07c5b..d47ddcb 100644 --- a/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java +++ b/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/LexerGrammar.java b/tool/src/org/antlr/v4/tool/LexerGrammar.java index 5c89ab8..1713a33 100644 --- a/tool/src/org/antlr/v4/tool/LexerGrammar.java +++ b/tool/src/org/antlr/v4/tool/LexerGrammar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/Rule.java b/tool/src/org/antlr/v4/tool/Rule.java index 986ea7f..401dfaa 100644 --- a/tool/src/org/antlr/v4/tool/Rule.java +++ b/tool/src/org/antlr/v4/tool/Rule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ToolMessage.java b/tool/src/org/antlr/v4/tool/ToolMessage.java index b340466..7af97e2 100644 --- a/tool/src/org/antlr/v4/tool/ToolMessage.java +++ b/tool/src/org/antlr/v4/tool/ToolMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/ActionAST.java b/tool/src/org/antlr/v4/tool/ast/ActionAST.java index 9ac97da..3067606 100644 --- a/tool/src/org/antlr/v4/tool/ast/ActionAST.java +++ b/tool/src/org/antlr/v4/tool/ast/ActionAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/AltAST.java b/tool/src/org/antlr/v4/tool/ast/AltAST.java index 38f5a6b..77e15d4 100644 --- a/tool/src/org/antlr/v4/tool/ast/AltAST.java +++ b/tool/src/org/antlr/v4/tool/ast/AltAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/BlockAST.java b/tool/src/org/antlr/v4/tool/ast/BlockAST.java index 9ddf349..dba507c 100644 --- a/tool/src/org/antlr/v4/tool/ast/BlockAST.java +++ b/tool/src/org/antlr/v4/tool/ast/BlockAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/GrammarAST.java b/tool/src/org/antlr/v4/tool/ast/GrammarAST.java index cb59b83..adad395 100644 --- a/tool/src/org/antlr/v4/tool/ast/GrammarAST.java +++ b/tool/src/org/antlr/v4/tool/ast/GrammarAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/GrammarASTErrorNode.java b/tool/src/org/antlr/v4/tool/ast/GrammarASTErrorNode.java index 472dcf5..dc64413 100644 --- a/tool/src/org/antlr/v4/tool/ast/GrammarASTErrorNode.java +++ b/tool/src/org/antlr/v4/tool/ast/GrammarASTErrorNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/GrammarASTVisitor.java b/tool/src/org/antlr/v4/tool/ast/GrammarASTVisitor.java index be92f85..c005c8f 100644 --- a/tool/src/org/antlr/v4/tool/ast/GrammarASTVisitor.java +++ b/tool/src/org/antlr/v4/tool/ast/GrammarASTVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/GrammarASTWithOptions.java b/tool/src/org/antlr/v4/tool/ast/GrammarASTWithOptions.java index f6b5bca..19e696f 100644 --- a/tool/src/org/antlr/v4/tool/ast/GrammarASTWithOptions.java +++ b/tool/src/org/antlr/v4/tool/ast/GrammarASTWithOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ @@ -43,7 +43,7 @@ public abstract class GrammarASTWithOptions extends GrammarAST { if ( v.startsWith("'") || v.startsWith("\"") ) { v = CharSupport.getStringFromGrammarStringLiteral(v); if (v == null) { - g.tool.errMgr.grammarError(ErrorType.INVALID_ESCAPE_SEQUENCE, g.fileName, value.getToken()); + g.tool.errMgr.grammarError(ErrorType.INVALID_ESCAPE_SEQUENCE, g.fileName, value.getToken(), value.getText()); v = ""; } } diff --git a/tool/src/org/antlr/v4/tool/ast/GrammarRootAST.java b/tool/src/org/antlr/v4/tool/ast/GrammarRootAST.java index 95f5128..5392145 100644 --- a/tool/src/org/antlr/v4/tool/ast/GrammarRootAST.java +++ b/tool/src/org/antlr/v4/tool/ast/GrammarRootAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/NotAST.java b/tool/src/org/antlr/v4/tool/ast/NotAST.java index ecd1d5a..620ec6e 100644 --- a/tool/src/org/antlr/v4/tool/ast/NotAST.java +++ b/tool/src/org/antlr/v4/tool/ast/NotAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/OptionalBlockAST.java b/tool/src/org/antlr/v4/tool/ast/OptionalBlockAST.java index 3a05d89..1b99249 100644 --- a/tool/src/org/antlr/v4/tool/ast/OptionalBlockAST.java +++ b/tool/src/org/antlr/v4/tool/ast/OptionalBlockAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/PlusBlockAST.java b/tool/src/org/antlr/v4/tool/ast/PlusBlockAST.java index ad0ae26..78881f5 100644 --- a/tool/src/org/antlr/v4/tool/ast/PlusBlockAST.java +++ b/tool/src/org/antlr/v4/tool/ast/PlusBlockAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/PredAST.java b/tool/src/org/antlr/v4/tool/ast/PredAST.java index 8069916..6cfe9ca 100644 --- a/tool/src/org/antlr/v4/tool/ast/PredAST.java +++ b/tool/src/org/antlr/v4/tool/ast/PredAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/QuantifierAST.java b/tool/src/org/antlr/v4/tool/ast/QuantifierAST.java index acfa942..3abb879 100644 --- a/tool/src/org/antlr/v4/tool/ast/QuantifierAST.java +++ b/tool/src/org/antlr/v4/tool/ast/QuantifierAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/RangeAST.java b/tool/src/org/antlr/v4/tool/ast/RangeAST.java index e285ca6..4630e8b 100644 --- a/tool/src/org/antlr/v4/tool/ast/RangeAST.java +++ b/tool/src/org/antlr/v4/tool/ast/RangeAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/RuleAST.java b/tool/src/org/antlr/v4/tool/ast/RuleAST.java index 3600971..5041ad2 100644 --- a/tool/src/org/antlr/v4/tool/ast/RuleAST.java +++ b/tool/src/org/antlr/v4/tool/ast/RuleAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/RuleElementAST.java b/tool/src/org/antlr/v4/tool/ast/RuleElementAST.java index e355604..6815d48 100644 --- a/tool/src/org/antlr/v4/tool/ast/RuleElementAST.java +++ b/tool/src/org/antlr/v4/tool/ast/RuleElementAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/RuleRefAST.java b/tool/src/org/antlr/v4/tool/ast/RuleRefAST.java index be07e58..bdde62e 100644 --- a/tool/src/org/antlr/v4/tool/ast/RuleRefAST.java +++ b/tool/src/org/antlr/v4/tool/ast/RuleRefAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/SetAST.java b/tool/src/org/antlr/v4/tool/ast/SetAST.java index 53c4c36..6c1fa78 100644 --- a/tool/src/org/antlr/v4/tool/ast/SetAST.java +++ b/tool/src/org/antlr/v4/tool/ast/SetAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/StarBlockAST.java b/tool/src/org/antlr/v4/tool/ast/StarBlockAST.java index 20b8793..9db14bb 100644 --- a/tool/src/org/antlr/v4/tool/ast/StarBlockAST.java +++ b/tool/src/org/antlr/v4/tool/ast/StarBlockAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ diff --git a/tool/src/org/antlr/v4/tool/ast/TerminalAST.java b/tool/src/org/antlr/v4/tool/ast/TerminalAST.java index fcac32d..234dd85 100644 --- a/tool/src/org/antlr/v4/tool/ast/TerminalAST.java +++ b/tool/src/org/antlr/v4/tool/ast/TerminalAST.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. + * 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. */ |