1/* 2 [The "BSD license"] 3 Copyright (c) 2010 Terence Parr 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions 8 are met: 9 1. Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 11 2. Redistributions in binary form must reproduce the above copyright 12 notice, this list of conditions and the following disclaimer in the 13 documentation and/or other materials provided with the distribution. 14 3. The name of the author may not be used to endorse or promote products 15 derived from this software without specific prior written permission. 16 17 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27*/ 28/* 29 New style messages. This file only contains the messages in English, but no 30 information about which file, line, or column it occurred in. 31 The location and message ids are taken out of the formats directory. 32 Kay Roepke 33*/ 34group en_US; 35 36// TOOL ERRORS 37// file errors 38CANNOT_WRITE_FILE(arg,exception,stackTrace) ::= << 39cannot write file <arg>: <exception> 40<stackTrace; separator="\n"> 41>> 42CANNOT_CLOSE_FILE(arg,exception,stackTrace) ::= "cannot close file <arg>: <exception>" 43CANNOT_FIND_TOKENS_FILE(arg) ::= "cannot find tokens file <arg>" 44ERROR_READING_TOKENS_FILE(arg,exception,stackTrace) ::= << 45problem reading token vocabulary file <arg>: <exception> 46<stackTrace; separator="\n"> 47>> 48DIR_NOT_FOUND(arg,exception,stackTrace) ::= "directory not found: <arg>" 49OUTPUT_DIR_IS_FILE(arg,exception,stackTrace) ::= "output directory is a file: <arg>" 50CANNOT_OPEN_FILE(arg,exception,stackTrace) ::= "cannot find or open file: <arg><if(exception)>; reason: <exception><endif>" 51CIRCULAR_DEPENDENCY() ::= "your grammars contain a circular dependency and cannot be sorted into a valid build order." 52 53INTERNAL_ERROR(arg,arg2,exception,stackTrace) ::= << 54internal error: <arg> <arg2><if(exception)>: <exception><endif> 55<stackTrace; separator="\n"> 56>> 57INTERNAL_WARNING(arg) ::= "internal warning: <arg>" 58ERROR_CREATING_ARTIFICIAL_RULE(arg,exception,stackTrace) ::= << 59problems creating lexer rule listing all tokens: <exception> 60<stackTrace; separator="\n"> 61>> 62TOKENS_FILE_SYNTAX_ERROR(arg,arg2) ::= 63 "problems parsing token vocabulary file <arg> on line <arg2>" 64CANNOT_GEN_DOT_FILE(arg,exception,stackTrace) ::= 65 "cannot write DFA DOT file <arg>: <exception>" 66BAD_ACTION_AST_STRUCTURE(exception,stackTrace) ::= 67 "bad internal tree structure for action '<arg>': <exception>" 68BAD_AST_STRUCTURE(arg,exception,stackTrace) ::= << 69bad internal tree structure '<arg>': <exception> 70<stackTrace; separator="\n"> 71>> 72FILE_AND_GRAMMAR_NAME_DIFFER(arg,arg2) ::= 73 "file <arg2> contains grammar <arg>; names must be identical" 74FILENAME_EXTENSION_ERROR(arg) ::= 75 "file <arg> must end in a file extension, normally .g" 76 77// code gen errors 78MISSING_CODE_GEN_TEMPLATES(arg) ::= 79 "cannot find code generation templates <arg>.stg" 80MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES() ::= 81 "cannot find code generation cyclic DFA templates for language <arg>" 82CODE_GEN_TEMPLATES_INCOMPLETE(arg) ::= 83 "at least one code generation template missing for language <arg>" 84CANNOT_CREATE_TARGET_GENERATOR(arg,exception,stackTrace) ::= 85 "cannot create target <arg> code generator: <exception>" 86STRING_TEMPLATE_ERROR(arg,exception,stackTrace) ::= 87 "template error: <arg>" 88CANNOT_COMPUTE_SAMPLE_INPUT_SEQ() ::= 89 "cannot generate a sample input sequence from lookahead DFA" 90 91// grammar interpretation errors 92/* 93NO_VIABLE_DFA_ALT(arg,arg2) ::= 94 "no viable transition from state <arg> on <arg2> while interpreting DFA" 95*/ 96 97// GRAMMAR ERRORS 98SYNTAX_ERROR(arg) ::= "syntax error: <arg>" 99RULE_REDEFINITION(arg) ::= 100 "rule <arg> redefinition" 101LEXER_RULES_NOT_ALLOWED(arg) ::= 102 "lexer rule <arg> not allowed in parser" 103PARSER_RULES_NOT_ALLOWED(arg) ::= 104 "parser rule <arg> not allowed in lexer" 105CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL(arg) ::= 106 "cannot find an attribute name in attribute declaration" 107NO_TOKEN_DEFINITION(arg) ::= 108 "no lexer rule corresponding to token: <arg>" 109UNDEFINED_RULE_REF(arg) ::= 110 "reference to undefined rule: <arg>" 111LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE(arg) ::= 112 "literal has no associated lexer rule: <arg>" 113CANNOT_ALIAS_TOKENS_IN_LEXER(arg) ::= 114 "literals are illegal in lexer tokens{} section: <arg>" 115ATTRIBUTE_REF_NOT_IN_RULE(arg,arg2) ::= 116 "reference to attribute outside of a rule: <arg><if(arg2)>.<arg2><endif>" 117UNKNOWN_ATTRIBUTE_IN_SCOPE(arg,arg2) ::= 118 "unknown attribute for <arg>: <arg2>" 119UNKNOWN_RULE_ATTRIBUTE(arg,arg2) ::= 120 "unknown attribute for rule <arg>: <arg2>" 121UNKNOWN_SIMPLE_ATTRIBUTE(arg,args2) ::= 122 "attribute is not a token, parameter, or return value: <arg>" 123ISOLATED_RULE_SCOPE(arg) ::= 124 "missing attribute access on rule scope: <arg>" 125INVALID_RULE_PARAMETER_REF(arg,arg2) ::= 126 "cannot access rule <arg>'s parameter: <arg2>" 127INVALID_RULE_SCOPE_ATTRIBUTE_REF(arg,arg2) ::= 128 "cannot access rule <arg>'s dynamically-scoped attribute: <arg2>" 129SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE(arg) ::= 130 "symbol <arg> conflicts with global dynamic scope with same name" 131WRITE_TO_READONLY_ATTR(arg,arg2,arg3) ::= 132 "cannot write to read only attribute: $<arg><if(arg2)>.<arg2><endif>" 133LABEL_CONFLICTS_WITH_RULE(arg) ::= 134 "label <arg> conflicts with rule with same name" 135LABEL_CONFLICTS_WITH_TOKEN(arg) ::= 136 "label <arg> conflicts with token with same name" 137LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE(arg,arg2) ::= 138 "label <arg> conflicts with rule <arg2>'s dynamically-scoped attribute with same name" 139LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL(arg,arg2) ::= 140 "label <arg> conflicts with rule <arg2>'s return value or parameter with same name" 141ATTRIBUTE_CONFLICTS_WITH_RULE(arg,arg2) ::= 142 "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with the rule name" 143ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL(arg,arg2) ::= 144 "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with<arg2>'s return value or parameter with same name" 145LABEL_TYPE_CONFLICT(arg,arg2) ::= 146 "label <arg> type mismatch with previous definition: <arg2>" 147ARG_RETVAL_CONFLICT(arg,arg2) ::= 148 "rule <arg2>'s argument <arg> conflicts a return value with same name" 149NONUNIQUE_REF(arg) ::= 150 "<arg> is a non-unique reference" 151FORWARD_ELEMENT_REF(arg) ::= 152 "illegal forward reference: <arg>" 153MISSING_RULE_ARGS(arg) ::= 154 "missing parameter(s) on rule reference: <arg>" 155RULE_HAS_NO_ARGS(arg) ::= 156 "rule <arg> has no defined parameters" 157ARGS_ON_TOKEN_REF(arg) ::= 158 "token reference <arg> may not have parameters" 159ILLEGAL_OPTION(arg) ::= 160 "illegal option <arg>" 161LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT(arg) ::= 162 "rule '+=' list labels are not allowed w/o output option: <arg>" 163UNDEFINED_TOKEN_REF_IN_REWRITE(arg) ::= 164 "reference to undefined token in rewrite rule: <arg>" 165REWRITE_ELEMENT_NOT_PRESENT_ON_LHS(arg) ::= 166 "reference to rewrite element <arg> without reference on left of ->" 167UNDEFINED_LABEL_REF_IN_REWRITE(arg) ::= 168 "reference to undefined label in rewrite rule: $<arg>" 169NO_GRAMMAR_START_RULE (arg) ::= 170 "grammar <arg>: no start rule (no rule can obviously be followed by EOF)" 171EMPTY_COMPLEMENT(arg) ::= << 172<if(arg)> 173set complement ~<arg> is empty 174<else> 175set complement is empty 176<endif> 177>> 178UNKNOWN_DYNAMIC_SCOPE(arg) ::= 179 "unknown dynamic scope: <arg>" 180UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE(arg,arg2) ::= 181 "unknown dynamically-scoped attribute for scope <arg>: <arg2>" 182RULE_REF_AMBIG_WITH_RULE_IN_ALT(arg) ::= 183 "reference $<arg> is ambiguous; rule <arg> is enclosing rule and referenced in the production (assuming enclosing rule)" 184ISOLATED_RULE_ATTRIBUTE(arg) ::= 185 "reference to locally-defined rule scope attribute without rule name: <arg>" 186INVALID_ACTION_SCOPE(arg,arg2) ::= 187 "unknown or invalid action scope for <arg2> grammar: <arg>" 188ACTION_REDEFINITION(arg) ::= 189 "redefinition of <arg> action" 190DOUBLE_QUOTES_ILLEGAL(arg) ::= 191 "string literals must use single quotes (such as \'begin\'): <arg>" 192INVALID_TEMPLATE_ACTION(arg) ::= 193 "invalid StringTemplate % shorthand syntax: '<arg>'" 194MISSING_ATTRIBUTE_NAME() ::= 195 "missing attribute name on $ reference" 196ARG_INIT_VALUES_ILLEGAL(arg) ::= 197 "rule parameters may not have init values: <arg>" 198REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION(arg) ::= 199 "<if(arg)>rule <arg> uses <endif>rewrite syntax or operator with no output option; setting output=AST" 200AST_OP_WITH_NON_AST_OUTPUT_OPTION(arg) ::= 201 "AST operator with non-AST output option: <arg>" 202NO_RULES(arg) ::= "grammar file <arg> has no rules" 203MISSING_AST_TYPE_IN_TREE_GRAMMAR(arg) ::= 204 "tree grammar <arg> has no ASTLabelType option" 205REWRITE_FOR_MULTI_ELEMENT_ALT(arg) ::= 206 "with rewrite=true, alt <arg> not simple node or obvious tree element; text attribute for rule not guaranteed to be correct" 207RULE_INVALID_SET(arg) ::= 208 "Cannot complement rule <arg>; not a simple set or element" 209HETERO_ILLEGAL_IN_REWRITE_ALT(arg) ::= 210 "alts with rewrites can't use heterogeneous types left of ->" 211NO_SUCH_GRAMMAR_SCOPE(arg,arg2) ::= 212 "reference to undefined grammar in rule reference: <arg>.<arg2>" 213NO_SUCH_RULE_IN_SCOPE(arg,arg2) ::= 214 "rule <arg2> is not defined in grammar <arg>" 215TOKEN_ALIAS_CONFLICT(arg,arg2) ::= 216 "cannot alias <arg>; string already assigned to <arg2>" 217TOKEN_ALIAS_REASSIGNMENT(arg,arg2) ::= 218 "cannot alias <arg>; token name already assigned to <arg2>" 219TOKEN_VOCAB_IN_DELEGATE(arg,arg2) ::= 220 "tokenVocab option ignored in imported grammar <arg>" 221INVALID_IMPORT(arg,arg2) ::= 222 "<arg.grammarTypeString> grammar <arg.name> cannot import <arg2.grammarTypeString> grammar <arg2.name>" 223IMPORTED_TOKENS_RULE_EMPTY(arg,arg2) ::= 224 "no lexer rules contributed to <arg> from imported grammar <arg2>" 225IMPORT_NAME_CLASH(arg,arg2) ::= 226 "combined grammar <arg.name> and imported <arg2.grammarTypeString> grammar <arg2.name> both generate <arg2.recognizerName>; import ignored" 227AST_OP_IN_ALT_WITH_REWRITE(arg,arg2) ::= 228 "rule <arg> alt <arg2> uses rewrite syntax and also an AST operator" 229WILDCARD_AS_ROOT(arg) ::= "Wildcard invalid as root; wildcard can itself be a tree" 230CONFLICTING_OPTION_IN_TREE_FILTER(arg,arg2) ::= "option <arg>=<arg2> conflicts with tree grammar filter mode" 231ILLEGAL_OPTION_VALUE(arg, arg2) ::= "value '<arg2>' invalid for option <arg>" 232ALL_OPS_NEED_SAME_ASSOC(arg) ::= "all operators of alt <alt> of left-recursive rule must have same associativity" 233RANGE_OP_ILLEGAL(arg) ::= "the .. range operator isn't allowed in parser rules" 234 235// GRAMMAR WARNINGS 236 237GRAMMAR_NONDETERMINISM(input,conflictingAlts,paths,disabled,hasPredicateBlockedByAction) ::= 238<< 239<if(paths)> 240Decision can match input such as "<input>" using multiple alternatives: 241<paths:{ it | alt <it.alt> via NFA path <it.states; separator=","><\n>}> 242<else> 243Decision can match input such as "<input>" using multiple alternatives: <conflictingAlts; separator=", "> 244<endif> 245<if(disabled)><\n>As a result, alternative(s) <disabled; separator=","> were disabled for that input<endif><if(hasPredicateBlockedByAction)><\n>Semantic predicates were present but were hidden by actions.<endif> 246>> 247 248DANGLING_STATE(danglingAlts,input) ::= << 249the decision cannot distinguish between alternative(s) <danglingAlts; separator=","> for input such as "<input>" 250>> 251 252UNREACHABLE_ALTS(alts) ::= << 253The following alternatives can never be matched: <alts; separator=","><\n> 254>> 255 256INSUFFICIENT_PREDICATES(upon,altToLocations,hasPredicateBlockedByAction) ::= << 257Input such as "<upon>" is insufficiently covered with predicates at locations: <altToLocations.keys:{alt|alt <alt>: <altToLocations.(alt):{loc| line <loc.line>:<loc.column> at <loc.text>}; separator=", ">}; separator=", "><if(hasPredicateBlockedByAction)><\n>Semantic predicates were present but were hidden by actions.<endif> 258>> 259 260DUPLICATE_SET_ENTRY(arg) ::= 261 "duplicate token type <arg> when collapsing subrule into set" 262 263ANALYSIS_ABORTED(enclosingRule) ::= << 264ANTLR could not analyze this decision in rule <enclosingRule>; often this is because of recursive rule references visible from the left edge of alternatives. ANTLR will re-analyze the decision with a fixed lookahead of k=1. Consider using "options {k=1;}" for that decision and possibly adding a syntactic predicate. 265>> 266 267RECURSION_OVERLOW(alt,input,targetRules,callSiteStates) ::= << 268Alternative <alt>: after matching input such as <input> decision cannot predict what comes next due to recursion overflow <targetRules,callSiteStates:{t,c|to <t> from <c:{s|<s.enclosingRule.name>};separator=", ">}; separator=" and "> 269>> 270 271LEFT_RECURSION(targetRules,alt,callSiteStates) ::= << 272Alternative <alt> discovers infinite left-recursion <targetRules,callSiteStates:{t,c|to <t> from <c:{s|<s.enclosingRule>};separator=", ">}; separator=" and "> 273>> 274 275UNREACHABLE_TOKENS(tokens) ::= << 276The following token definitions can never be matched because prior tokens match the same input: <tokens; separator=","> 277>> 278 279TOKEN_NONDETERMINISM(input,conflictingTokens,paths,disabled,hasPredicateBlockedByAction) ::= 280<< 281<if(paths)> 282Decision can match input such as "<input>" using multiple alternatives: 283<paths:{ it | alt <it.alt> via NFA path <it.states; separator=","><\n>}> 284<else> 285Multiple token rules can match input such as "<input>": <conflictingTokens; separator=", "><\n> 286<endif> 287<if(disabled)><\n>As a result, token(s) <disabled; separator=","> were disabled for that input<endif><if(hasPredicateBlockedByAction)><\n>Semantic predicates were present but were hidden by actions.<endif> 288>> 289 290LEFT_RECURSION_CYCLES(listOfCycles) ::= << 291The following sets of rules are mutually left-recursive <listOfCycles:{c| [<c:{r|<r.name>}; separator=", ">]}; separator=" and "> 292>> 293 294NONREGULAR_DECISION(ruleName,alts) ::= << 295[fatal] rule <ruleName> has non-LL(*) decision due to recursive rule invocations reachable from alts <alts; separator=",">. Resolve by left-factoring or using syntactic predicates or using backtrack=true option. 296>> 297 298/* l10n for message levels */ 299warning() ::= "warning" 300error() ::= "error" 301