Home | History | Annotate | Download | only in languages
      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 */
     34 group en_US;
     35 
     36 // TOOL ERRORS
     37 // file errors
     38 CANNOT_WRITE_FILE(arg,exception,stackTrace) ::= <<
     39 cannot write file <arg>: <exception>
     40 <stackTrace; separator="\n">
     41 >>
     42 CANNOT_CLOSE_FILE(arg,exception,stackTrace) ::= "cannot close file <arg>: <exception>"
     43 CANNOT_FIND_TOKENS_FILE(arg) ::= "cannot find tokens file <arg>"
     44 ERROR_READING_TOKENS_FILE(arg,exception,stackTrace) ::= <<
     45 problem reading token vocabulary file <arg>: <exception>
     46 <stackTrace; separator="\n">
     47 >>
     48 DIR_NOT_FOUND(arg,exception,stackTrace) ::= "directory not found: <arg>"
     49 OUTPUT_DIR_IS_FILE(arg,exception,stackTrace) ::= "output directory is a file: <arg>"
     50 CANNOT_OPEN_FILE(arg,exception,stackTrace) ::= "cannot find or open file: <arg><if(exception)>; reason: <exception><endif>"
     51 CIRCULAR_DEPENDENCY() ::= "your grammars contain a circular dependency and cannot be sorted into a valid build order."
     52 
     53 INTERNAL_ERROR(arg,arg2,exception,stackTrace) ::= <<
     54 internal error: <arg> <arg2><if(exception)>: <exception><endif>
     55 <stackTrace; separator="\n">
     56 >>
     57 INTERNAL_WARNING(arg) ::= "internal warning: <arg>"
     58 ERROR_CREATING_ARTIFICIAL_RULE(arg,exception,stackTrace) ::= <<
     59 problems creating lexer rule listing all tokens: <exception>
     60 <stackTrace; separator="\n">
     61 >>
     62 TOKENS_FILE_SYNTAX_ERROR(arg,arg2) ::=
     63 	"problems parsing token vocabulary file <arg> on line <arg2>"
     64 CANNOT_GEN_DOT_FILE(arg,exception,stackTrace) ::=
     65 	"cannot write DFA DOT file <arg>: <exception>"
     66 BAD_ACTION_AST_STRUCTURE(exception,stackTrace) ::=
     67 	"bad internal tree structure for action '<arg>': <exception>"
     68 BAD_AST_STRUCTURE(arg,exception,stackTrace) ::= <<
     69 bad internal tree structure '<arg>': <exception>
     70 <stackTrace; separator="\n">
     71 >>
     72 FILE_AND_GRAMMAR_NAME_DIFFER(arg,arg2) ::=
     73   "file <arg2> contains grammar <arg>; names must be identical"
     74 FILENAME_EXTENSION_ERROR(arg) ::=
     75   "file <arg> must end in a file extension, normally .g"
     76 
     77 // code gen errors
     78 MISSING_CODE_GEN_TEMPLATES(arg) ::=
     79 	"cannot find code generation templates <arg>.stg"
     80 MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES() ::=
     81 	"cannot find code generation cyclic DFA templates for language <arg>"
     82 CODE_GEN_TEMPLATES_INCOMPLETE(arg) ::=
     83 	"at least one code generation template missing for language <arg>"
     84 CANNOT_CREATE_TARGET_GENERATOR(arg,exception,stackTrace) ::=
     85 	"cannot create target <arg> code generator: <exception>"
     86 CANNOT_COMPUTE_SAMPLE_INPUT_SEQ() ::=
     87 	"cannot generate a sample input sequence from lookahead DFA"
     88 
     89 // grammar interpretation errors
     90 /*
     91 NO_VIABLE_DFA_ALT(arg,arg2) ::=
     92 	"no viable transition from state <arg> on <arg2> while interpreting DFA"
     93 */
     94 
     95 // GRAMMAR ERRORS
     96 SYNTAX_ERROR(arg) ::= "syntax error: <arg>"
     97 RULE_REDEFINITION(arg) ::=
     98 	"rule <arg> redefinition"
     99 LEXER_RULES_NOT_ALLOWED(arg) ::=
    100 	"lexer rule <arg> not allowed in parser"
    101 PARSER_RULES_NOT_ALLOWED(arg) ::=
    102 	"parser rule <arg> not allowed in lexer"
    103 CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL(arg) ::=
    104 	"cannot find an attribute name in attribute declaration"
    105 NO_TOKEN_DEFINITION(arg) ::=
    106 	"no lexer rule corresponding to token: <arg>"
    107 UNDEFINED_RULE_REF(arg) ::=
    108 	"reference to undefined rule: <arg>"
    109 LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE(arg) ::=
    110 	"literal has no associated lexer rule: <arg>"
    111 CANNOT_ALIAS_TOKENS_IN_LEXER(arg) ::=
    112 	"literals are illegal in lexer tokens{} section: <arg>"
    113 ATTRIBUTE_REF_NOT_IN_RULE(arg,arg2) ::=
    114 	"reference to attribute outside of a rule: <arg><if(arg2)>.<arg2><endif>"
    115 UNKNOWN_ATTRIBUTE_IN_SCOPE(arg,arg2) ::=
    116 	"unknown attribute for <arg>: <arg2>"
    117 UNKNOWN_RULE_ATTRIBUTE(arg,arg2) ::=
    118 	"unknown attribute for rule <arg>: <arg2>"
    119 UNKNOWN_SIMPLE_ATTRIBUTE(arg,args2) ::=
    120 	"attribute is not a token, parameter, or return value: <arg>"
    121 ISOLATED_RULE_SCOPE(arg) ::=
    122 	"missing attribute access on rule scope: <arg>"
    123 INVALID_RULE_PARAMETER_REF(arg,arg2) ::=
    124 	"cannot access rule <arg>'s parameter: <arg2>"
    125 INVALID_RULE_SCOPE_ATTRIBUTE_REF(arg,arg2) ::=
    126 	"cannot access rule <arg>'s dynamically-scoped attribute: <arg2>"
    127 SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE(arg) ::=
    128 	"symbol <arg> conflicts with global dynamic scope with same name"
    129 WRITE_TO_READONLY_ATTR(arg,arg2,arg3) ::=
    130 	"cannot write to read only attribute: $<arg><if(arg2)>.<arg2><endif>"
    131 LABEL_CONFLICTS_WITH_RULE(arg) ::=
    132 	"label <arg> conflicts with rule with same name"
    133 LABEL_CONFLICTS_WITH_TOKEN(arg) ::=
    134 	"label <arg> conflicts with token with same name"
    135 LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE(arg,arg2) ::=
    136 	"label <arg> conflicts with rule <arg2>'s dynamically-scoped attribute with same name"
    137 LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL(arg,arg2) ::=
    138 	"label <arg> conflicts with rule <arg2>'s return value or parameter with same name"
    139 ATTRIBUTE_CONFLICTS_WITH_RULE(arg,arg2) ::=
    140 	"rule <arg2>'s dynamically-scoped attribute <arg> conflicts with the rule name"
    141 ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL(arg,arg2) ::=
    142 	"rule <arg2>'s dynamically-scoped attribute <arg> conflicts with<arg2>'s return value or parameter with same name"
    143 LABEL_TYPE_CONFLICT(arg,arg2) ::=
    144 	"label <arg> type mismatch with previous definition: <arg2>"
    145 ARG_RETVAL_CONFLICT(arg,arg2) ::=
    146 	"rule <arg2>'s argument <arg> conflicts a return value with same name"
    147 NONUNIQUE_REF(arg) ::=
    148 	"<arg> is a non-unique reference"
    149 FORWARD_ELEMENT_REF(arg) ::=
    150 	"illegal forward reference: <arg>"
    151 MISSING_RULE_ARGS(arg) ::=
    152 	"missing parameter(s) on rule reference: <arg>"
    153 RULE_HAS_NO_ARGS(arg) ::=
    154 	"rule <arg> has no defined parameters"
    155 ARGS_ON_TOKEN_REF(arg) ::=
    156 	"token reference <arg> may not have parameters"
    157 ILLEGAL_OPTION(arg) ::=
    158 	"illegal option <arg>"
    159 LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT(arg) ::=
    160 	"rule '+=' list labels are not allowed w/o output option: <arg>"
    161 UNDEFINED_TOKEN_REF_IN_REWRITE(arg) ::=
    162   "reference to undefined token in rewrite rule: <arg>"
    163 REWRITE_ELEMENT_NOT_PRESENT_ON_LHS(arg) ::=
    164   "reference to rewrite element <arg> without reference on left of ->"
    165 UNDEFINED_LABEL_REF_IN_REWRITE(arg) ::=
    166   "reference to undefined label in rewrite rule: $<arg>"
    167 NO_GRAMMAR_START_RULE (arg) ::=
    168   "grammar <arg>: no start rule (no rule can obviously be followed by EOF)"
    169 EMPTY_COMPLEMENT(arg) ::= <<
    170 <if(arg)>
    171 set complement ~<arg> is empty
    172 <else>
    173 set complement is empty
    174 <endif>
    175 >>
    176 UNKNOWN_DYNAMIC_SCOPE(arg) ::=
    177   "unknown dynamic scope: <arg>"
    178 UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE(arg,arg2) ::=
    179   "unknown dynamically-scoped attribute for scope <arg>: <arg2>"
    180 RULE_REF_AMBIG_WITH_RULE_IN_ALT(arg) ::=
    181   "reference $<arg> is ambiguous; rule <arg> is enclosing rule and referenced in the production (assuming enclosing rule)"
    182 ISOLATED_RULE_ATTRIBUTE(arg) ::=
    183   "reference to locally-defined rule scope attribute without rule name: <arg>"
    184 INVALID_ACTION_SCOPE(arg,arg2) ::=
    185   "unknown or invalid action scope for <arg2> grammar: <arg>"
    186 ACTION_REDEFINITION(arg) ::=
    187   "redefinition of <arg> action"
    188 DOUBLE_QUOTES_ILLEGAL(arg) ::=
    189   "string literals must use single quotes (such as \'begin\'): <arg>"
    190 INVALID_TEMPLATE_ACTION(arg) ::=
    191   "invalid StringTemplate % shorthand syntax: '<arg>'"
    192 MISSING_ATTRIBUTE_NAME() ::=
    193   "missing attribute name on $ reference"
    194 ARG_INIT_VALUES_ILLEGAL(arg) ::=
    195   "rule parameters may not have init values: <arg>"
    196 REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION(arg) ::=
    197   "<if(arg)>rule <arg> uses <endif>rewrite syntax or operator with no output option; setting output=AST"
    198 AST_OP_WITH_NON_AST_OUTPUT_OPTION(arg) ::=
    199   "AST operator with non-AST output option: <arg>"
    200 NO_RULES(arg) ::= "grammar file <arg> has no rules"
    201 MISSING_AST_TYPE_IN_TREE_GRAMMAR(arg) ::=
    202   "tree grammar <arg> has no ASTLabelType option"
    203 REWRITE_FOR_MULTI_ELEMENT_ALT(arg) ::=
    204   "with rewrite=true, alt <arg> not simple node or obvious tree element; text attribute for rule not guaranteed to be correct"
    205 RULE_INVALID_SET(arg) ::=
    206   "Cannot complement rule <arg>; not a simple set or element"
    207 HETERO_ILLEGAL_IN_REWRITE_ALT(arg) ::=
    208   "alts with rewrites can't use heterogeneous types left of ->"
    209 NO_SUCH_GRAMMAR_SCOPE(arg,arg2) ::=
    210   "reference to undefined grammar in rule reference: <arg>.<arg2>"
    211 NO_SUCH_RULE_IN_SCOPE(arg,arg2) ::=
    212   "rule <arg2> is not defined in grammar <arg>"
    213 TOKEN_ALIAS_CONFLICT(arg,arg2) ::=
    214   "cannot alias <arg>; string already assigned to <arg2>"
    215 TOKEN_ALIAS_REASSIGNMENT(arg,arg2) ::=
    216   "cannot alias <arg>; token name already assigned to <arg2>"
    217 TOKEN_VOCAB_IN_DELEGATE(arg,arg2) ::=
    218   "tokenVocab option ignored in imported grammar <arg>"
    219 INVALID_IMPORT(arg,arg2) ::=
    220   "<arg.grammarTypeString> grammar <arg.name> cannot import <arg2.grammarTypeString> grammar <arg2.name>"
    221 IMPORTED_TOKENS_RULE_EMPTY(arg,arg2) ::=
    222   "no lexer rules contributed to <arg> from imported grammar <arg2>"
    223 IMPORT_NAME_CLASH(arg,arg2) ::=
    224   "combined grammar <arg.name> and imported <arg2.grammarTypeString> grammar <arg2.name> both generate <arg2.recognizerName>; import ignored"
    225 AST_OP_IN_ALT_WITH_REWRITE(arg,arg2) ::=
    226   "rule <arg> alt <arg2> uses rewrite syntax and also an AST operator"
    227 WILDCARD_AS_ROOT(arg) ::= "Wildcard invalid as root; wildcard can itself be a tree"
    228 CONFLICTING_OPTION_IN_TREE_FILTER(arg,arg2) ::= "option <arg>=<arg2> conflicts with tree grammar filter mode"
    229 ILLEGAL_OPTION_VALUE(arg, arg2) ::= "value '<arg2>' invalid for option <arg>"
    230 ALL_OPS_NEED_SAME_ASSOC(arg) ::= "all operators of alt <alt> of left-recursive rule must have same associativity"
    231 
    232 // GRAMMAR WARNINGS
    233 
    234 GRAMMAR_NONDETERMINISM(input,conflictingAlts,paths,disabled,hasPredicateBlockedByAction) ::=
    235 <<
    236 <if(paths)>
    237 Decision can match input such as "<input>" using multiple alternatives:
    238 <paths:{ it |  alt <it.alt> via NFA path <it.states; separator=","><\n>}>
    239 <else>
    240 Decision can match input such as "<input>" using multiple alternatives: <conflictingAlts; separator=", ">
    241 <endif>
    242 <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>
    243 >>
    244 
    245 DANGLING_STATE(danglingAlts,input) ::= <<
    246 the decision cannot distinguish between alternative(s) <danglingAlts; separator=","> for input such as "<input>"
    247 >>
    248 
    249 UNREACHABLE_ALTS(alts) ::= <<
    250 The following alternatives can never be matched: <alts; separator=","><\n>
    251 >>
    252 
    253 INSUFFICIENT_PREDICATES(upon,altToLocations,hasPredicateBlockedByAction) ::= <<
    254 Input 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>
    255 >>
    256 
    257 DUPLICATE_SET_ENTRY(arg) ::=
    258 	"duplicate token type <arg> when collapsing subrule into set"
    259 
    260 ANALYSIS_ABORTED(enclosingRule) ::= <<
    261 ANTLR 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.
    262 >>
    263 
    264 RECURSION_OVERLOW(alt,input,targetRules,callSiteStates) ::= <<
    265 Alternative <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 ">
    266 >>
    267 
    268 LEFT_RECURSION(targetRules,alt,callSiteStates) ::= <<
    269 Alternative <alt> discovers infinite left-recursion <targetRules,callSiteStates:{t,c|to <t> from <c:{s|<s.enclosingRule>};separator=", ">}; separator=" and ">
    270 >>
    271 
    272 UNREACHABLE_TOKENS(tokens) ::= <<
    273 The following token definitions can never be matched because prior tokens match the same input: <tokens; separator=",">
    274 >>
    275 
    276 TOKEN_NONDETERMINISM(input,conflictingTokens,paths,disabled,hasPredicateBlockedByAction) ::=
    277 <<
    278 <if(paths)>
    279 Decision can match input such as "<input>" using multiple alternatives:
    280 <paths:{ it | alt <it.alt> via NFA path <it.states; separator=","><\n>}>
    281 <else>
    282 Multiple token rules can match input such as "<input>": <conflictingTokens; separator=", "><\n>
    283 <endif>
    284 <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>
    285 >>
    286 
    287 LEFT_RECURSION_CYCLES(listOfCycles) ::= <<
    288 The following sets of rules are mutually left-recursive <listOfCycles:{c| [<c:{r|<r.name>}; separator=", ">]}; separator=" and ">
    289 >>
    290 
    291 NONREGULAR_DECISION(ruleName,alts) ::= <<
    292 [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.
    293 >>
    294 
    295 /* l10n for message levels */
    296 warning() ::= "warning"
    297 error() ::= "error"
    298