diff --git a/lib/puppet/pops/parser/egrammar.ra b/lib/puppet/pops/parser/egrammar.ra index f81e7a0d7..a1d639cc2 100644 --- a/lib/puppet/pops/parser/egrammar.ra +++ b/lib/puppet/pops/parser/egrammar.ra @@ -1,765 +1,769 @@ # vim: syntax=ruby # Parser using the Pops model, expression based class Puppet::Pops::Parser::Parser token STRING DQPRE DQMID DQPOST +token WORD token LBRACK RBRACK LBRACE RBRACE SYMBOL FARROW COMMA TRUE token FALSE EQUALS APPENDS DELETES LESSEQUAL NOTEQUAL DOT COLON LLCOLLECT RRCOLLECT token QMARK LPAREN RPAREN ISEQUAL GREATEREQUAL GREATERTHAN LESSTHAN token IF ELSE token DEFINE ELSIF VARIABLE CLASS INHERITS NODE BOOLEAN token NAME SEMIC CASE DEFAULT AT ATAT LCOLLECT RCOLLECT CLASSREF token NOT OR AND UNDEF PARROW PLUS MINUS TIMES DIV LSHIFT RSHIFT UMINUS token MATCH NOMATCH REGEX IN_EDGE OUT_EDGE IN_EDGE_SUB OUT_EDGE_SUB token IN UNLESS PIPE token LAMBDA SELBRACE token NUMBER token HEREDOC SUBLOCATE token RENDER_STRING RENDER_EXPR EPP_START EPP_END EPP_END_TRIM token FUNCTION token LOW prechigh left HIGH left SEMIC left PIPE left LPAREN left RPAREN left AT ATAT left DOT left CALL nonassoc EPP_START left LBRACK LISTSTART left RBRACK left QMARK left LCOLLECT LLCOLLECT right NOT nonassoc UMINUS left IN left MATCH NOMATCH left TIMES DIV MODULO left MINUS PLUS left LSHIFT RSHIFT left NOTEQUAL ISEQUAL left GREATEREQUAL GREATERTHAN LESSTHAN LESSEQUAL left AND left OR right APPENDS DELETES EQUALS left LBRACE left SELBRACE left RBRACE left IN_EDGE OUT_EDGE IN_EDGE_SUB OUT_EDGE_SUB left TITLE_COLON left CASE_COLON left FARROW left COMMA nonassoc RENDER_EXPR nonassoc RENDER_STRING left LOW preclow rule # Produces [Model::BlockExpression, Model::Expression, nil] depending on multiple statements, single statement or empty program : statements { result = create_program(Factory.block_or_expression(*val[0])) } | epp_expression { result = create_program(Factory.block_or_expression(*val[0])) } | nil # Produces a semantic model (non validated, but semantically adjusted). statements : syntactic_statements { result = transform_calls(val[0]) } # Change may have issues with nil; i.e. program is a sequence of nils/nops # Simplified from original which had validation for top level constructs - see statement rule # Produces Array syntactic_statements : syntactic_statement { result = [val[0]]} | syntactic_statements SEMIC syntactic_statement { result = val[0].push val[2] } | syntactic_statements syntactic_statement { result = val[0].push val[1] } # Produce a single expression or Array of expression syntactic_statement : any_expression { result = val[0] } | syntactic_statement COMMA any_expression { result = aryfy(val[0]).push val[2] } any_expression : relationship_expression relationship_expression : resource_expression =LOW { result = val[0] } | relationship_expression IN_EDGE relationship_expression { result = val[0].relop(val[1][:value], val[2]); loc result, val[1] } | relationship_expression IN_EDGE_SUB relationship_expression { result = val[0].relop(val[1][:value], val[2]); loc result, val[1] } | relationship_expression OUT_EDGE relationship_expression { result = val[0].relop(val[1][:value], val[2]); loc result, val[1] } | relationship_expression OUT_EDGE_SUB relationship_expression { result = val[0].relop(val[1][:value], val[2]); loc result, val[1] } #---EXPRESSION # # Produces Model::Expression expression : higher_precedence | expression LBRACK expressions RBRACK =LBRACK { result = val[0][*val[2]] ; loc result, val[0], val[3] } | expression IN expression { result = val[0].in val[2] ; loc result, val[1] } | expression MATCH expression { result = val[0] =~ val[2] ; loc result, val[1] } | expression NOMATCH expression { result = val[0].mne val[2] ; loc result, val[1] } | expression PLUS expression { result = val[0] + val[2] ; loc result, val[1] } | expression MINUS expression { result = val[0] - val[2] ; loc result, val[1] } | expression DIV expression { result = val[0] / val[2] ; loc result, val[1] } | expression TIMES expression { result = val[0] * val[2] ; loc result, val[1] } | expression MODULO expression { result = val[0] % val[2] ; loc result, val[1] } | expression LSHIFT expression { result = val[0] << val[2] ; loc result, val[1] } | expression RSHIFT expression { result = val[0] >> val[2] ; loc result, val[1] } | MINUS expression =UMINUS { result = val[1].minus() ; loc result, val[0] } | expression NOTEQUAL expression { result = val[0].ne val[2] ; loc result, val[1] } | expression ISEQUAL expression { result = val[0] == val[2] ; loc result, val[1] } | expression GREATERTHAN expression { result = val[0] > val[2] ; loc result, val[1] } | expression GREATEREQUAL expression { result = val[0] >= val[2] ; loc result, val[1] } | expression LESSTHAN expression { result = val[0] < val[2] ; loc result, val[1] } | expression LESSEQUAL expression { result = val[0] <= val[2] ; loc result, val[1] } | NOT expression { result = val[1].not ; loc result, val[0] } | expression AND expression { result = val[0].and val[2] ; loc result, val[1] } | expression OR expression { result = val[0].or val[2] ; loc result, val[1] } | expression EQUALS expression { result = val[0].set(val[2]) ; loc result, val[1] } | expression APPENDS expression { result = val[0].plus_set(val[2]) ; loc result, val[1] } | expression DELETES expression { result = val[0].minus_set(val[2]); loc result, val[1] } | expression QMARK selector_entries { result = val[0].select(*val[2]) ; loc result, val[0] } | LPAREN expression RPAREN { result = val[1].paren() ; loc result, val[0] } #---EXPRESSIONS # (e.g. argument list) # # This expression list can not contain function calls without parentheses around arguments # Produces Array expressions : expression { result = [val[0]] } | expressions COMMA expression { result = val[0].push(val[2]) } # These go through a chain of left recursion, ending with primary_expression higher_precedence : call_function_expression primary_expression : literal_expression | variable | call_method_with_lambda_expression | collection_expression | case_expression | if_expression | unless_expression | definition_expression | hostclass_expression | node_definition_expression | epp_render_expression | function_definition # Allways have the same value literal_expression : array | boolean | default | hash | regex | text_or_name | number | type | undef text_or_name : name { result = val[0] } | quotedtext { result = val[0] } #---CALL FUNCTION # # Produces Model::CallNamedFunction call_function_expression : primary_expression LPAREN expressions endcomma RPAREN { result = Factory.CALL_NAMED(val[0], true, val[2]) loc result, val[0], val[4] } | primary_expression LPAREN RPAREN { result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] } | primary_expression LPAREN expressions endcomma RPAREN lambda { result = Factory.CALL_NAMED(val[0], true, val[2]) loc result, val[0], val[4] result.lambda = val[5] } | primary_expression LPAREN RPAREN lambda { result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] result.lambda = val[3] } | primary_expression = LOW { result = val[0] } #---CALL METHOD # call_method_with_lambda_expression : call_method_expression =LOW { result = val[0] } | call_method_expression lambda { result = val[0]; val[0].lambda = val[1] } call_method_expression : named_access LPAREN expressions RPAREN { result = Factory.CALL_METHOD(val[0], val[2]); loc result, val[1], val[3] } | named_access LPAREN RPAREN { result = Factory.CALL_METHOD(val[0], []); loc result, val[1], val[3] } | named_access =LOW { result = Factory.CALL_METHOD(val[0], []); loc result, val[0] } # TODO: It may be of value to access named elements of types too named_access : expression DOT NAME { result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] } #---LAMBDA # # This is a temporary switch while experimenting with concrete syntax # One should be picked for inclusion in puppet. # Lambda with parameters to the left of the body lambda : lambda_parameter_list lambda_rest { result = Factory.LAMBDA(val[0], val[1]) # loc result, val[1] # TODO } lambda_rest : LBRACE statements RBRACE { result = val[1] } | LBRACE RBRACE { result = nil } # Produces Array lambda_parameter_list : PIPE PIPE { result = [] } | PIPE parameters endcomma PIPE { result = val[1] } #---CONDITIONALS # #--IF # # Produces Model::IfExpression if_expression : IF if_part { result = val[1] loc(result, val[0], val[1]) } # Produces Model::IfExpression if_part : expression LBRACE statements RBRACE else { result = Factory.IF(val[0], Factory.block_or_expression(*val[2]), val[4]) loc(result, val[0], (val[4] ? val[4] : val[3])) } | expression LBRACE RBRACE else { result = Factory.IF(val[0], nil, val[3]) loc(result, val[0], (val[3] ? val[3] : val[2])) } # Produces [Model::Expression, nil] - nil if there is no else or elsif part else : # nothing | ELSIF if_part { result = val[1] loc(result, val[0], val[1]) } | ELSE LBRACE statements RBRACE { result = Factory.block_or_expression(*val[2]) loc result, val[0], val[3] } | ELSE LBRACE RBRACE { result = nil # don't think a nop is needed here either } #--UNLESS # # Changed from Puppet 3x where there is no else part on unless # unless_expression : UNLESS expression LBRACE statements RBRACE unless_else { result = Factory.UNLESS(val[1], Factory.block_or_expression(*val[3]), val[5]) loc result, val[0], val[4] } | UNLESS expression LBRACE RBRACE unless_else { result = Factory.UNLESS(val[1], nil, nil) loc result, val[0], val[4] } # Different from else part of if, since "elsif" is not supported, but 'else' is # # Produces [Model::Expression, nil] - nil if there is no else or elsif part unless_else : # nothing | ELSE LBRACE statements RBRACE { result = Factory.block_or_expression(*val[2]) loc result, val[0], val[3] } | ELSE LBRACE RBRACE { result = nil # don't think a nop is needed here either } #--- CASE EXPRESSION # # Produces Model::CaseExpression case_expression : CASE expression LBRACE case_options RBRACE { result = Factory.CASE(val[1], *val[3]) loc result, val[0], val[4] } # Produces Array case_options : case_option { result = [val[0]] } | case_options case_option { result = val[0].push val[1] } # Produced Model::CaseOption (aka When) case_option : expressions case_colon LBRACE statements RBRACE { result = Factory.WHEN(val[0], val[3]) loc result, val[1], val[4] } | expressions case_colon LBRACE RBRACE = LOW { result = Factory.WHEN(val[0], nil) loc result, val[1], val[3] } case_colon: COLON =CASE_COLON { result = val[0] } # This special construct is required or racc will produce the wrong result when the selector entry # LHS is generalized to any expression (LBRACE looks like a hash). Thus it is not possible to write # a selector with a single entry where the entry LHS is a hash. # The SELBRACE token is a LBRACE that follows a QMARK, and this is produced by the lexer with a lookback # Produces Array # selector_entries : selector_entry | SELBRACE selector_entry_list endcomma RBRACE { result = val[1] } # Produces Array selector_entry_list : selector_entry { result = [val[0]] } | selector_entry_list COMMA selector_entry { result = val[0].push val[2] } # Produces a Model::SelectorEntry # This FARROW wins over FARROW in Hash selector_entry : expression FARROW expression { result = Factory.MAP(val[0], val[2]) ; loc result, val[1] } #---RESOURCE # # Produces [Model::ResourceExpression, Model::ResourceDefaultsExpression] # The resource expression parses a generalized syntax and then selects the correct # resulting model based on the combinatoin of the LHS and what follows. # It also handled exported and virtual resources, and the class case # resource_expression : expression =LOW { result = val[0] } | at expression LBRACE resourceinstances endsemi RBRACE { result = case Factory.resource_shape(val[1]) when :resource, :class tmp = Factory.RESOURCE(Factory.fqn(token_text(val[1])), val[3]) tmp.form = val[0] tmp when :defaults error val[1], "A resource default can not be virtual or exported" when :override error val[1], "A resource override can not be virtual or exported" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[1], val[4] } | at expression LBRACE attribute_operations endcomma RBRACE { result = case Factory.resource_shape(val[1]) when :resource, :class, :defaults, :override error val[1], "Defaults are not virtualizable" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end } | expression LBRACE resourceinstances endsemi RBRACE { result = case Factory.resource_shape(val[0]) when :resource, :class Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) when :defaults error val[1], "A resource default can not specify a resource name" when :override error val[1], "A resource override does not allow override of name of resource" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[0], val[4] } | expression LBRACE attribute_operations endcomma RBRACE { result = case Factory.resource_shape(val[0]) when :resource, :class # This catches deprecated syntax. # If the attribute operations does not include +>, then the found expression # is actually a LEFT followed by LITERAL_HASH # unless tmp = transform_resource_wo_title(val[0], val[2]) error val[1], "Syntax error resource body without title or hash with +>" end tmp when :defaults Factory.RESOURCE_DEFAULTS(val[0], val[2]) when :override # This was only done for override in original - TODO shuld it be here at all Factory.RESOURCE_OVERRIDE(val[0], val[2]) else error val[0], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[0], val[4] } | at CLASS LBRACE resourceinstances endsemi RBRACE { result = Factory.RESOURCE(Factory.fqn(token_text(val[1])), val[3]) result.form = val[0] loc result, val[1], val[5] } | CLASS LBRACE resourceinstances endsemi RBRACE { result = Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) loc result, val[0], val[4] } resourceinst : expression title_colon attribute_operations endcomma { result = Factory.RESOURCE_BODY(val[0], val[2]) } title_colon : COLON =TITLE_COLON { result = val[0] } resourceinstances : resourceinst { result = [val[0]] } | resourceinstances SEMIC resourceinst { result = val[0].push val[2] } # Produces Symbol corresponding to resource form # at : AT { result = :virtual } | AT AT { result = :exported } | ATAT { result = :exported } #---COLLECTION # # A Collection is a predicate applied to a set of objects with an implied context (used variables are # attributes of the object. # i.e. this is equivalent for source.select(QUERY).apply(ATTRIBUTE_OPERATIONS) # # Produces Model::CollectExpression # collection_expression : expression collect_query LBRACE attribute_operations endcomma RBRACE { result = Factory.COLLECT(val[0], val[1], val[3]) loc result, val[0], val[5] } | expression collect_query =LOW { result = Factory.COLLECT(val[0], val[1], []) loc result, val[0], val[1] } collect_query : LCOLLECT optional_query RCOLLECT { result = Factory.VIRTUAL_QUERY(val[1]) ; loc result, val[0], val[2] } | LLCOLLECT optional_query RRCOLLECT { result = Factory.EXPORTED_QUERY(val[1]) ; loc result, val[0], val[2] } optional_query : nil | expression #---ATTRIBUTE OPERATIONS # # (Not an expression) # # Produces Array # attribute_operations : { result = [] } | attribute_operation { result = [val[0]] } | attribute_operations COMMA attribute_operation { result = val[0].push(val[2]) } # Produces String # QUESTION: Why is BOOLEAN valid as an attribute name? # attribute_name : NAME | keyword | BOOLEAN # In this version, illegal combinations are validated instead of producing syntax errors # (Can give nicer error message "+> is not applicable to...") # Produces Model::AttributeOperation # attribute_operation : attribute_name FARROW expression { result = Factory.ATTRIBUTE_OP(val[0][:value], :'=>', val[2]) loc result, val[0], val[2] } | attribute_name PARROW expression { result = Factory.ATTRIBUTE_OP(val[0][:value], :'+>', val[2]) loc result, val[0], val[2] } #---DEFINE # # Produces Model::Definition # definition_expression : DEFINE classname parameter_list LBRACE opt_statements RBRACE { result = add_definition(Factory.DEFINITION(classname(val[1][:value]), val[2], val[4])) loc result, val[0], val[5] # New lexer does not keep track of this, this is done in validation if @lexer.respond_to?(:'indefine=') @lexer.indefine = false end } #---HOSTCLASS # # Produces Model::HostClassDefinition # hostclass_expression : CLASS stacked_classname parameter_list classparent LBRACE opt_statements RBRACE { # Remove this class' name from the namestack as all nested classes have been parsed namepop result = add_definition(Factory.HOSTCLASS(classname(val[1][:value]), val[2], token_text(val[3]), val[5])) loc result, val[0], val[6] } # Record the classname so nested classes gets a fully qualified name at parse-time # This is a separate rule since racc does not support intermediate actions. # stacked_classname : classname { namestack(val[0][:value]) ; result = val[0] } opt_statements : statements | nil # Produces String, name or nil result classparent : nil | INHERITS classnameordefault { result = val[1] } # Produces String (this construct allows a class to be named "default" and to be referenced as # the parent class. # TODO: Investigate the validity # Produces a String (classname), or a token (DEFAULT). # classnameordefault : classname | DEFAULT #---NODE # # Produces Model::NodeDefinition # node_definition_expression : NODE hostnames nodeparent LBRACE statements RBRACE { result = add_definition(Factory.NODE(val[1], val[2], val[4])) loc result, val[0], val[5] } | NODE hostnames nodeparent LBRACE RBRACE { result = add_definition(Factory.NODE(val[1], val[2], nil)) loc result, val[0], val[4] } # Hostnames is not a list of names, it is a list of name matchers (including a Regexp). # (The old implementation had a special "Hostname" object with some minimal validation) # # Produces Array # hostnames : hostname { result = [result] } | hostnames COMMA hostname { result = val[0].push(val[2]) } # Produces a LiteralExpression (string, :default, or regexp) # String with interpolation is validated for better error message hostname : dotted_name { result = val[0] } | quotedtext { result = val[0] } | DEFAULT { result = Factory.literal(:default); loc result, val[0] } | regex dotted_name : NAME { result = Factory.literal(val[0][:value]); loc result, val[0] } | dotted_name DOT NAME { result = Factory.concat(val[0], '.', val[2][:value]); loc result, val[0], val[2] } # Produces Expression, since hostname is an Expression nodeparent : nil | INHERITS hostname { result = val[1] } #---FUNCTION DEFINITION # function_definition : FUNCTION { result = Factory.QNAME(val[0][:value]) ; loc result, val[0] } # For now the function word will just be reserved, in the future it will # produce a function definition # FUNCTION classname parameter_list LBRACE opt_statements RBRACE { # result = add_definition(Factory.FUNCTION(val[1][:value], val[2], val[4])) # loc result, val[0], val[5] # } #---NAMES AND PARAMETERS COMMON TO SEVERAL RULES # Produces String # TODO: The error that "class" is not a valid classname is bad - classname rule is also used for other things classname : NAME { result = val[0] } | CLASS { error val[0], "'class' is not a valid classname" } # Produces Array parameter_list : nil { result = [] } | LPAREN RPAREN { result = [] } | LPAREN parameters endcomma RPAREN { result = val[1] } # Produces Array parameters : parameter { result = [val[0]] } | parameters COMMA parameter { result = val[0].push(val[2]) } # Produces Model::Parameter parameter : VARIABLE EQUALS expression { result = Factory.PARAM(val[0][:value], val[2]) ; loc result, val[0] } | VARIABLE { result = Factory.PARAM(val[0][:value]); loc result, val[0] } #--RESTRICTED EXPRESSIONS # i.e. where one could have expected an expression, but the set is limited ## What is allowed RHS of match operators (see expression) #match_rvalue # : regex # | text_or_name #--VARIABLE # variable : VARIABLE { result = Factory.fqn(val[0][:value]).var ; loc result, val[0] } #---LITERALS (dynamic and static) # array : LBRACK expressions RBRACK { result = Factory.LIST(val[1]); loc result, val[0], val[2] } | LBRACK expressions COMMA RBRACK { result = Factory.LIST(val[1]); loc result, val[0], val[3] } | LBRACK RBRACK { result = Factory.literal([]) ; loc result, val[0] } | LISTSTART expressions RBRACK { result = Factory.LIST(val[1]); loc result, val[0], val[2] } | LISTSTART expressions COMMA RBRACK { result = Factory.LIST(val[1]); loc result, val[0], val[3] } | LISTSTART RBRACK { result = Factory.literal([]) ; loc result, val[0] } hash : LBRACE hashpairs RBRACE { result = Factory.HASH(val[1]); loc result, val[0], val[2] } | LBRACE hashpairs COMMA RBRACE { result = Factory.HASH(val[1]); loc result, val[0], val[3] } | LBRACE RBRACE { result = Factory.literal({}) ; loc result, val[0], val[3] } hashpairs : hashpair { result = [val[0]] } | hashpairs COMMA hashpair { result = val[0].push val[2] } hashpair : expression FARROW expression { result = Factory.KEY_ENTRY(val[0], val[2]); loc result, val[1] } quotedtext : string | dq_string | heredoc -string : STRING { result = Factory.literal(val[0][:value]) ; loc result, val[0] } +string + : STRING { result = Factory.literal(val[0][:value]) ; loc result, val[0] } + | WORD { result = Factory.literal(val[0][:value]) ; loc result, val[0] } + dq_string : dqpre dqrval { result = Factory.string(val[0], *val[1]) ; loc result, val[0], val[1][-1] } dqpre : DQPRE { result = Factory.literal(val[0][:value]); loc result, val[0] } dqpost : DQPOST { result = Factory.literal(val[0][:value]); loc result, val[0] } dqmid : DQMID { result = Factory.literal(val[0][:value]); loc result, val[0] } dqrval : text_expression dqtail { result = [val[0]] + val[1] } text_expression : expression { result = Factory.TEXT(val[0]) } dqtail : dqpost { result = [val[0]] } | dqmid dqrval { result = [val[0]] + val[1] } heredoc : HEREDOC sublocated_text { result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] } sublocated_text : SUBLOCATE string { result = Factory.SUBLOCATE(val[0], val[1]); loc result, val[0] } | SUBLOCATE dq_string { result = Factory.SUBLOCATE(val[0], val[1]); loc result, val[0] } epp_expression : EPP_START epp_parameters_list statements { result = Factory.EPP(val[1], val[2]); loc result, val[0] } epp_parameters_list : =LOW{ result = nil } | PIPE PIPE { result = [] } | PIPE parameters endcomma PIPE { result = val[1] } epp_render_expression : RENDER_STRING { result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] } | RENDER_EXPR expression epp_end { result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] } | RENDER_EXPR LBRACE statements RBRACE epp_end { result = Factory.RENDER_EXPR(Factory.block_or_expression(*val[2])); loc result, val[0], val[4] } epp_end : EPP_END | EPP_END_TRIM number : NUMBER { result = Factory.NUMBER(val[0][:value]) ; loc result, val[0] } name : NAME { result = Factory.QNAME_OR_NUMBER(val[0][:value]) ; loc result, val[0] } type : CLASSREF { result = Factory.QREF(val[0][:value]) ; loc result, val[0] } undef : UNDEF { result = Factory.literal(:undef); loc result, val[0] } default : DEFAULT { result = Factory.literal(:default); loc result, val[0] } # Assumes lexer produces a Boolean value for booleans, or this will go wrong and produce a literal string # with the text 'true'. #TODO: could be changed to a specific boolean literal factory method to prevent this possible glitch. boolean : BOOLEAN { result = Factory.literal(val[0][:value]) ; loc result, val[0] } regex : REGEX { result = Factory.literal(val[0][:value]); loc result, val[0] } #---MARKERS, SPECIAL TOKENS, SYNTACTIC SUGAR, etc. endcomma : # | COMMA { result = nil } endsemi : # | SEMIC keyword : AND | CASE | CLASS | DEFAULT | DEFINE | ELSE | ELSIF | IF | IN | INHERITS | NODE | OR | UNDEF | UNLESS nil : { result = nil} end ---- header ---- require 'puppet' require 'puppet/pops' module Puppet class ParseError < Puppet::Error; end class ImportError < Racc::ParseError; end class AlreadyImportedError < ImportError; end end ---- inner ---- # Make emacs happy # Local Variables: # mode: ruby # End: diff --git a/lib/puppet/pops/parser/eparser.rb b/lib/puppet/pops/parser/eparser.rb index 2d524b95a..31b5bbee0 100644 --- a/lib/puppet/pops/parser/eparser.rb +++ b/lib/puppet/pops/parser/eparser.rb @@ -1,2610 +1,2627 @@ # # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.9 # from Racc grammer file "". # require 'racc/parser.rb' require 'puppet' require 'puppet/pops' module Puppet class ParseError < Puppet::Error; end class ImportError < Racc::ParseError; end class AlreadyImportedError < ImportError; end end module Puppet module Pops module Parser class Parser < Racc::Parser -module_eval(<<'...end egrammar.ra/module_eval...', 'egrammar.ra', 761) +module_eval(<<'...end egrammar.ra/module_eval...', 'egrammar.ra', 765) # Make emacs happy # Local Variables: # mode: ruby # End: ...end egrammar.ra/module_eval... ##### State transition tables begin ### clist = [ -'59,61,277,-131,53,240,55,-218,267,-133,-227,362,315,226,247,267,59,61', -'237,246,226,226,300,14,355,59,61,245,233,42,242,49,244,52,46,128,50', -'71,67,127,44,70,47,48,278,-131,68,13,260,-218,69,-133,-227,12,137,223', -'128,135,59,61,127,72,53,137,55,397,135,43,266,262,263,66,62,267,64,65', -'63,72,124,51,128,14,249,54,127,250,72,42,62,49,330,52,46,318,50,71,67', -'62,44,70,47,48,237,128,68,13,128,127,69,128,127,12,333,127,128,274,59', -'61,127,72,53,365,55,335,81,43,350,222,349,66,62,337,64,65,350,76,349', -'51,104,14,108,54,103,59,61,42,299,49,298,52,46,276,50,71,67,74,44,70', -'47,48,252,251,68,13,107,116,69,342,343,12,77,79,78,80,59,61,344,72,53', -'226,55,395,81,43,213,347,82,66,62,243,64,65,351,353,292,51,104,14,108', -'54,103,189,274,42,276,49,274,52,46,361,50,71,67,298,44,70,47,48,291', -'298,68,13,107,76,69,156,153,12,151,372,314,290,59,61,374,72,53,276,55', -'393,81,43,276,129,82,66,62,274,64,65,377,116,117,51,104,14,108,54,103', -'317,116,42,381,49,353,52,46,383,50,71,67,384,44,70,47,48,385,386,68', -'13,107,387,69,113,389,12,390,391,321,76,59,61,73,72,53,398,55,399,81', -'43,400,401,,66,62,,64,65,,,,51,104,14,108,54,103,,,42,,49,,52,110,,50', -'71,67,,44,70,,,,,68,13,107,,69,,,12,,,,,59,61,,72,53,,55,,81,43,,,,66', -'62,,64,65,,,,51,104,14,108,54,103,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,107,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,', -'51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,', -',,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52', -'110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,', -',,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44,70,47,48', -',,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14', -',54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61', -',72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50', -'71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62', -',64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,', -'69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51', -',14,,54,,,,42,,49,,52,123,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59', -'61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,', -'50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66', -'62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13', -',,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,', -',42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,296,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67', -',44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,140,55,,,43,,,,66,62', -',64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,', -'69,,,12,,,,,59,61,,72,53,142,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,', -',,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72', -'53,,55,145,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71', -'67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64', -'65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,', -',12,,,,,59,61,,72,53,,55,302,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,145,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67', -',44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,155,,,43,,,,66,62,', -'64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69', -',,12,,,,,59,61,,72,53,,55,371,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44', -'70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65', -',,,51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44,70,47,48,,,68,13,,,69,', -',12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49', -',52,46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44,70', -'47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,', -',51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12', -',,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52', -'46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43', -',,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67,,44,70,47,48', -',,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14', -',54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61', -',72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50', -'71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62', -',64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,', -'69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51', -',14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59', -'61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,', -'50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66', -'62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13', -',,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,', -',42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,', -'44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65', -',,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12', -',,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52', -'110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,', -',,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,', -'68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14', -',54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61', -',72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50', -'71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62', -',64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,', -'69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51', -',14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59', -'61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,', -'50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66', -'62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13', -',,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,', -',42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,', -'44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,356,,43,,,188,66,62,', -'64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69', -',,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,191', -'208,202,209,52,203,211,204,200,198,,193,206,,,,,68,13,212,207,205,,', -'12,,,,,59,61,,72,53,,55,,210,192,,,,66,62,,64,65,,,,51,,14,,54,,,,42', -',49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51', -',14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59', -'61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,', -'50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66', -'62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13', -',,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,', -',42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53', -',55,304,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,46,,50,71,67', -',44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64', -'65,,,,51,,14,220,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69', -',,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,', -'49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55', -',,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51', -',14,228,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,', -',,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52', -'46,,50,71,67,,44,70,47,48,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43', -',,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,', -',68,13,,,69,,,12,,,,,59,61,,72,53,324,55,,,43,,,,66,62,,64,65,,,,51', -',14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59', -'61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,', -'50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66', -'62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13', -',,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,', -',42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53', -'323,55,,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67', -',44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65', -',,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12', -',,,,59,61,,72,53,,55,326,,43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49', -',52,110,,50,71,67,,44,70,,,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,', -'43,,,,66,62,,64,65,,,,51,,14,,54,,,,42,,49,,52,110,,50,71,67,,44,70', -',,,,68,13,,,69,,,12,,,,,59,61,,72,53,,55,,,43,,,,66,62,,64,65,,59,61', -'51,,14,,54,,,,191,208,202,209,52,203,211,204,200,198,,193,206,,59,61', -',68,13,212,207,205,,,12,,,,137,,,135,72,,,,,210,192,,,,66,62,,64,65', -'81,,,51,72,137,,54,135,100,101,102,97,92,104,62,108,,103,,,93,95,94', -'96,,,,72,,,,,,,,,,,62,107,,,,99,98,,,85,86,88,87,90,91,,83,84,,,,,81', -'82,105,,,248,,,,100,101,102,97,92,104,,108,,103,89,,93,95,94,96,,,,', -',,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,248,,,82,100', -'101,102,97,92,104,,108,,103,,,93,95,94,96,,89,,,,,,,,,,,,,,107,,,,99', -'98,,,85,86,88,87,90,91,,83,84,,,,,81,82,232,,,,,,,100,101,102,97,92', -'104,,108,,103,89,,93,95,94,96,,,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88', -'87,90,91,81,83,84,,,,,,82,100,101,102,97,92,104,,108,,103,,,93,95,94', -'96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,,83,84,,,,,81,82', -'231,,,,,,,100,101,102,97,92,104,,108,,103,89,,93,95,94,96,,,,,,,,,,', -',,,,,107,,,,99,98,,,85,86,88,87,90,91,,83,84,,,,,81,82,230,,,,,,,100', -'101,102,97,92,104,,108,,103,89,,93,95,94,96,,,,,,,,,,,,,,,,107,,,,99', -'98,,,85,86,88,87,90,91,,83,84,,,,,81,82,229,,,,,,,100,101,102,97,92', -'104,,108,,103,89,,93,95,94,96,,,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88', -'87,90,91,81,83,84,,,,,,82,100,101,102,97,92,104,,108,,103,,218,93,95', -'94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,', -',,82,100,101,102,97,92,104,,108,,103,,,93,95,94,96,,89,,,,,,,,,,,,,', -'107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,,,,82,100,101,102,97,92', -'104,,108,,103,262,263,93,95,94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85', -'86,88,87,90,91,81,83,84,,,,,,82,100,101,102,97,92,104,,108,,103,,,93', -'95,94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84', -',,,,,82,100,101,102,97,92,104,,108,,103,,,93,95,94,96,,89,,,,,,,,,,', -',,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,,,,82,100,101,102,97', -'92,104,,108,,103,,,93,95,94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86', -'88,87,90,91,81,83,84,,,,,,82,100,101,102,97,92,104,,108,,103,,,93,95', -'94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,', -',,82,100,101,102,97,92,104,,108,81,103,,81,93,95,94,96,,89,,,,,104,', -'108,104,103,108,,103,,107,,,,99,98,,,85,86,88,87,90,91,,83,84,107,,', -'107,,82,,,,,88,87,81,88,87,83,84,,83,84,,,82,89,,82,104,,108,,103,,', -',,81,,,,,89,,,89,100,101,102,97,92,104,,108,107,103,,,93,95,94,96,85', -'86,88,87,,,,83,84,,,,,,82,107,,,,99,98,,,85,86,88,87,90,91,81,83,84', -'89,,,,,82,100,101,102,97,92,104,272,108,,103,,,93,95,94,96,,89,,,,,', -',,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,,83,84,,,,,81,82,105,,,,,,', -'100,101,102,97,92,104,,108,81,103,89,,93,95,94,96,,,,,,,104,,108,,103', -',,,,107,,,,99,98,,,85,86,88,87,90,91,,83,84,107,,,81,,82,,,85,86,88', -'87,,,,83,84,104,,108,81,103,82,89,,,,,,,,,,,104,,108,,103,,89,,,107', -',,,,,,,85,86,88,87,90,91,,83,84,107,,,,,82,,,85,86,88,87,90,91,81,83', -'84,,,,,,82,89,,,,92,104,,108,81,103,,,93,,,,,89,,,,92,104,,108,,103', -',,93,,107,,,,,,,,85,86,88,87,90,91,,83,84,107,,,,,82,,,85,86,88,87,90', -'91,81,83,84,,,,,,82,89,,,,92,104,,108,81,103,,,93,,,,,89,,,,92,104,', -'108,,103,,,93,,107,,,,,,,,85,86,88,87,90,91,,83,84,107,,,,,82,,,85,86', -'88,87,90,91,81,83,84,,,,,,82,89,,,97,92,104,,108,,103,,81,93,95,94,96', -',89,,,,,,97,92,104,,108,,103,,107,93,95,94,96,,,,85,86,88,87,90,91,', -'83,84,,,,107,,82,,,98,,,85,86,88,87,90,91,81,83,84,,,,89,,82,100,101', -'102,97,92,104,,108,,103,,,93,95,94,96,,89,,,,,,,,,,,,,,107,,,,99,98', -',,85,86,88,87,90,91,81,83,84,,,268,,,82,100,101,102,97,92,104,,108,', -'103,,,93,95,94,96,,89,,,,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91', -'81,83,84,,,,,,82,100,101,102,97,92,104,,108,,103,,,93,95,94,96,,89,', -',,,,,,,,,,,,107,,,,99,98,,,85,86,88,87,90,91,81,83,84,,,,,,82,100,101', -'102,97,92,104,,108,81,103,,81,93,95,94,96,,89,,,,,104,,108,104,103,108', -',103,,107,,,,99,98,,81,85,86,88,87,90,91,,83,84,107,,,107,104,82,108', -',103,,,,,,,83,84,,83,84,,,82,89,,82,,,,,107,,,,,,,,,,,,,,,83,84,,286', -'208,285,209,82,283,211,287,281,280,,282,284,,,,,,,212,207,288,286,208', -'285,209,,283,211,287,281,280,,282,284,,,210,289,,,212,207,288,286,208', -'285,209,,283,211,287,281,280,,282,284,,,210,289,,,212,207,288,,,,,,', -',,,,,,,,,210,289' ] - racc_action_table = arr = ::Array.new(6523, nil) +'59,62,241,278,60,53,316,55,-131,268,-219,-133,268,-228,227,227,117,267', +'356,59,62,227,268,60,14,250,301,243,251,129,42,238,49,128,52,46,366', +'50,72,68,331,44,71,47,48,279,275,69,13,261,-131,70,-219,-133,12,-228', +'224,322,138,59,62,136,73,60,53,248,55,398,43,246,247,334,67,63,245,65', +'66,64,59,62,51,73,60,14,54,351,129,350,238,42,128,49,63,52,46,129,50', +'72,68,128,44,71,47,48,59,62,69,13,60,336,70,129,129,12,223,128,128,138', +'59,62,136,73,60,53,351,55,350,43,263,264,338,67,63,77,65,66,234,59,62', +'51,73,60,14,54,78,80,79,81,42,300,49,63,52,46,299,50,72,68,75,44,71', +'47,48,277,129,69,13,117,128,70,253,252,12,343,344,345,138,59,62,136', +'73,60,53,227,55,396,43,214,348,315,67,63,352,65,66,125,59,62,51,73,60', +'14,54,354,293,190,275,42,277,49,63,52,46,275,50,72,68,362,44,71,47,48', +'363,129,69,13,292,128,70,299,77,12,157,154,152,138,59,62,136,73,60,53', +'373,55,394,43,244,291,375,67,63,277,65,66,277,130,275,51,73,378,14,54', +'117,118,318,299,42,382,49,63,52,46,354,50,72,68,384,44,71,47,48,385', +'386,69,13,387,388,70,114,390,12,391,392,319,77,59,62,74,73,60,53,399', +'55,400,43,401,402,,67,63,82,65,66,,,,51,,,14,54,,,,105,42,109,49,104', +'52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,', +'55,,43,,,,67,63,82,65,66,83,,,51,,,14,54,,,,105,42,109,49,104,52,111', +',50,72,68,,44,71,,,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,,55,,43', +',84,85,67,63,82,65,66,83,,,51,,,14,54,,,,105,42,109,49,104,52,111,,50', +'72,68,,44,71,,,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,,55,,43,,84', +'85,67,63,82,65,66,83,,,51,,,14,54,,,,105,42,109,49,104,52,111,,50,72', +'68,,44,71,,,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,,55,,43,,,,67,63', +'82,65,66,83,,,51,,,14,54,,,,105,42,109,49,104,52,46,,50,72,68,,44,71', +'47,48,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,,55,,43,,84,85,67,63', +'82,65,66,83,,,51,,,14,54,,,,105,42,109,49,104,52,111,,50,72,68,,44,71', +',,,,69,13,,,70,,,12,108,,,,59,62,,73,60,53,,55,,43,,,,67,63,82,65,66', +',,,51,,,14,54,,,,105,42,109,49,104,52,111,,50,72,68,,44,71,,,,,69,13', +',,70,,,12,108,,,,59,62,,73,60,53,,55,,43,,,,67,63,82,65,66,,,,51,,,14', +'54,,,,105,42,109,49,104,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +'108,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42', +',49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66', +',,,51,,,14,54,,,,,42,,49,,52,124,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49', +',52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55', +',43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71', +',,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,297,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49', +',52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +'141,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68', +',44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,143,55,,43,,,,67,63,', +'65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,', +'70,,,12,,,,,59,62,,73,60,53,,55,146,43,,,,67,63,,65,66,,,,51,,,14,54', +',,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73', +'60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72', +'68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,303,43,,,,67,63', +',65,66,,,,51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44,71,47,48,,,69,13', +',,70,,,12,,,,,59,62,,73,60,53,,55,146,43,,,,67,63,,65,66,,,,51,,,14', +'54,,,,,42,,49,,52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59', +'62,,73,60,53,,156,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111', +',50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,372,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44,71,47', +'48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,', +'51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49', +',52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44', +'71,47,48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65', +'66,,,,51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44,71,47,48,,,69,13,,', +'70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,', +',,42,,49,,52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59,62,', +'73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,46,,50', +'72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,', +'67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,46,,50,72,68,,44,71,47,48', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43', +',,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,', +',,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51', +',,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,', +'59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52', +'111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,357', +'43,,,189,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44', +'71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,', +',,51,,,14,54,,,,,192,209,203,210,52,204,212,205,201,199,,194,207,,,', +',69,13,213,208,206,,,12,,,,,59,62,,73,60,53,,55,211,193,,,,67,63,,65', +'66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70', +',,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42', +',49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66', +',,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49', +',52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55', +',43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71', +',,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,305,43,,,,67,63,82,65,66', +',,,51,,,14,54,,,,105,42,109,49,104,52,46,,50,72,68,,44,71,47,48,,,69', +'13,,,70,,,12,108,,,,,,,73,,,89,88,,43,,84,85,67,63,,65,66,83,59,62,51', +',60,53,54,55,,,,,,,,,,90,,,,,,,14,221,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66', +',,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,,55,,43,,,,67,63,82,65,66,,,,51,,,14,54,,,,105,42', +'109,49,104,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,108,,,,,,,73', +',,89,88,,43,,84,85,67,63,,65,66,83,59,62,51,,60,53,54,55,,,,,,,,,,90', +',,,,,,14,229,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49', +',52,46,,50,72,68,,44,71,47,48,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,325,55,,43,,,,67,63,,65', +'66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70', +',,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42', +',49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66', +',,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12', +',,,,59,62,,73,60,53,324,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42', +',49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,', +'44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53,,55,327,43,,,,67,63,,65', +'66,,,,51,,,14,54,,,,,42,,49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70', +',,12,,,,,59,62,,73,60,53,,55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,42', +',49,,52,111,,50,72,68,,44,71,,,,,69,13,,,70,,,12,,,,,59,62,,73,60,53', +',55,,43,,,,67,63,,65,66,,,,51,,,14,54,,,,,192,209,203,210,52,204,212', +'205,201,199,,194,207,,,,,69,13,213,208,206,,,12,,,,,,,,73,,,,,211,193', +',,,67,63,,65,66,82,,,51,,,,54,,101,102,103,98,93,105,,109,,104,,,94', +'96,95,97,,,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,,84,85,,,', +',82,83,106,,,249,,,,101,102,103,98,93,105,,109,,104,90,,94,96,95,97', +',,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85,,,249,,,83', +'101,102,103,98,93,105,,109,,104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,', +',,100,99,,,86,87,89,88,91,92,,84,85,,,,,82,83,233,,,,,,,101,102,103', +'98,93,105,,109,,104,90,,94,96,95,97,,,,,,,,,,,,,,,,108,,,,100,99,,,86', +'87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98,93,105,,109,,104,,,94', +'96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,,84,85,', +',,,82,83,232,,,,,,,101,102,103,98,93,105,,109,,104,90,,94,96,95,97,', +',,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,,84,85,,,,,82,83,231', +',,,,,,101,102,103,98,93,105,,109,,104,90,,94,96,95,97,,,,,,,,,,,,,,', +',108,,,,100,99,,,86,87,89,88,91,92,,84,85,,,,,82,83,230,,,,,,,101,102', +'103,98,93,105,,109,,104,90,,94,96,95,97,,,,,,,,,,,,,,,,108,,,,100,99', +',,86,87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98,93,105,,109,,104', +',219,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92', +'82,84,85,,,,,,83,101,102,103,98,93,105,,109,,104,,,94,96,95,97,,90,', +',,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85,,,,,,83,101,102', +'103,98,93,105,,109,,104,263,264,94,96,95,97,,90,,,,,,,,,,,,,,108,,,', +'100,99,,,86,87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98,93,105,,109', +',104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92', +'82,84,85,,,,,,83,101,102,103,98,93,105,,109,,104,,,94,96,95,97,,90,', +',,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85,,,,,,83,101,102', +'103,98,93,105,,109,,104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99', +',,86,87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98,93,105,,109,,104', +',,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82', +'84,85,,,,,,83,101,102,103,98,93,105,,109,,104,,,94,96,95,97,,90,,,,', +',,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85,,,,,,83,101,102', +'103,98,93,105,,109,,104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99', +',,86,87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98,93,105,273,109,', +'104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92', +',84,85,,,,,82,83,106,,,,,,,101,102,103,98,93,105,,109,82,104,90,,94', +'96,95,97,,,,,,,105,,109,,104,,,,,108,,,,100,99,,,86,87,89,88,91,92,', +'84,85,108,,,82,,83,,,86,87,89,88,,,,84,85,105,,109,82,104,83,90,,,,', +',,,,,,105,,109,,104,,90,,,108,,,,,,,,86,87,89,88,,,,84,85,108,,,82,', +'83,,,86,87,89,88,91,92,,84,85,105,,109,82,104,83,90,,,,,,,,,,93,105', +',109,,104,,90,94,,108,,,,,,,,86,87,89,88,91,92,,84,85,108,,,,,83,,,86', +'87,89,88,91,92,82,84,85,,,,,,83,90,,,,93,105,,109,82,104,,,94,,,,,90', +',,,93,105,,109,,104,,,94,,108,,,,,,,,86,87,89,88,91,92,,84,85,108,,', +',,83,,,86,87,89,88,91,92,82,84,85,,,,,,83,90,,,,93,105,,109,,104,,82', +'94,,,,,90,,,,,,98,93,105,,109,,104,,108,94,96,95,97,,,,86,87,89,88,91', +'92,,84,85,,,,108,,83,,,82,,,86,87,89,88,91,92,,84,85,98,93,105,90,109', +'83,104,,82,94,96,95,97,,,,,101,102,103,98,93,105,90,109,,104,,108,94', +'96,95,97,99,,,86,87,89,88,91,92,,84,85,,,,108,,83,,100,99,,,86,87,89', +'88,91,92,82,84,85,,,269,90,,83,101,102,103,98,93,105,,109,,104,,,94', +'96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85', +',,,,,83,101,102,103,98,93,105,,109,,104,,,94,96,95,97,,90,,,,,,,,,,', +',,,108,,,,100,99,,,86,87,89,88,91,92,82,84,85,,,,,,83,101,102,103,98', +'93,105,,109,,104,,,94,96,95,97,,90,,,,,,,,,,,,,,108,,,,100,99,,,86,87', +'89,88,91,92,,84,85,,287,209,286,210,83,284,212,288,282,281,,283,285', +',,,,,,213,208,289,90,287,209,286,210,,284,212,288,282,281,,283,285,', +'211,290,,,,213,208,289,287,209,286,210,,284,212,288,282,281,,283,285', +',,211,290,,,213,208,289,,,,,,,,,,,,,,,,211,290' ] + racc_action_table = arr = ::Array.new(6559, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| arr[idx] = i.to_i unless i.empty? idx += 1 end end clist = [ -'0,0,201,198,0,131,0,206,227,200,205,312,237,153,141,305,242,242,125', -'141,116,237,227,0,305,240,240,139,123,0,131,0,139,0,0,203,0,0,0,203', -'0,0,0,0,201,198,0,0,153,206,0,200,205,0,242,116,123,242,384,384,123', -'0,384,240,384,384,240,0,163,330,330,0,0,163,0,0,0,242,46,0,49,384,144', -'0,49,144,240,384,242,384,265,384,384,239,384,384,384,240,384,384,384', -'384,130,202,384,384,46,202,384,110,46,384,269,110,314,234,5,5,314,384', -'5,314,5,273,165,384,347,115,347,384,384,275,384,384,302,157,302,384', -'165,5,165,384,165,151,151,5,226,5,224,5,5,279,5,5,5,5,5,5,5,5,149,149', -'5,5,165,220,5,293,295,5,8,8,8,8,383,383,297,5,383,298,383,383,166,5', -'106,301,165,5,5,133,5,5,303,304,219,5,166,383,166,5,166,104,308,383', -'309,383,310,383,383,311,383,383,383,259,383,383,383,383,217,316,383', -'383,166,75,383,73,63,383,62,329,235,215,381,381,332,383,381,195,381', -'381,164,383,334,47,166,383,383,194,383,383,341,342,41,383,164,381,164', -'383,164,238,40,381,350,381,351,381,381,353,381,381,381,354,381,381,381', -'381,358,359,381,381,164,360,381,39,366,381,367,370,243,6,188,188,1,381', -'188,388,188,392,111,381,394,396,,381,381,,381,381,,,,381,111,188,111', -'381,111,,,188,,188,,188,188,,188,188,188,,188,188,,,,,188,188,111,,188', -',,188,,,,,12,12,,188,12,,12,,109,188,,,,188,188,,188,188,,,,188,109', -'12,109,188,109,,,12,,12,,12,12,,12,12,12,,12,12,,,,,12,12,109,,12,,', -'12,,,,,13,13,,12,13,,13,,,12,,,,12,12,,12,12,,,,12,,13,,12,,,,13,,13', -',13,13,,13,13,13,,13,13,,,,,13,13,,,13,,,13,,,,,14,14,,13,14,,14,,,13', -',,,13,13,,13,13,,,,13,,14,,13,,,,14,,14,,14,14,,14,14,14,,14,14,,,,', -'14,14,,,14,,,14,,,,,362,362,,14,362,,362,,,14,,,,14,14,,14,14,,,,14', -',362,,14,,,,362,,362,,362,362,,362,362,362,,362,362,362,362,,,362,362', -',,362,,,362,,,,,349,349,,362,349,,349,,,362,,,,362,362,,362,362,,,,362', -',349,,362,,,,349,,349,,349,349,,349,349,349,,349,349,,,,,349,349,,,349', -',,349,,,,,191,191,,349,191,,191,,,349,,,,349,349,,349,349,,,,349,,191', -',349,,,,191,,191,,191,191,,191,191,191,,191,191,,,,,191,191,,,191,,', -'191,,,,,42,42,,191,42,,42,,,191,,,,191,191,,191,191,,,,191,,42,,191', -',,,42,,42,,42,42,,42,42,42,,42,42,,,,,42,42,,,42,,,42,,,,,43,43,,42', -'43,,43,,,42,,,,42,42,,42,42,,,,42,,43,,42,,,,43,,43,,43,43,,43,43,43', -',43,43,,,,,43,43,,,43,,,43,,,,,44,44,,43,44,,44,,,43,,,,43,43,,43,43', -',,,43,,44,,43,,,,44,,44,,44,44,,44,44,44,,44,44,,,,,44,44,,,44,,,44', -',,,,45,45,,44,45,,45,,,44,,,,44,44,,44,44,,,,44,,45,,44,,,,45,,45,,45', -'45,,45,45,45,,45,45,,,,,45,45,,,45,,,45,,,,,192,192,,45,192,,192,,,45', -',,,45,45,,45,45,,,,45,,192,,45,,,,192,,192,,192,192,,192,192,192,,192', -'192,,,,,192,192,,,192,,,192,,,,,193,193,,192,193,,193,,,192,,,,192,192', -',192,192,,,,192,,193,,192,,,,193,,193,,193,193,,193,193,193,,193,193', -',,,,193,193,,,193,,,193,,,,,333,333,,193,333,,333,,,193,,,,193,193,', -'193,193,,,,193,,333,,193,,,,333,,333,,333,333,,333,333,333,,333,333', -',,,,333,333,,,333,,,333,,,,,222,222,,333,222,,222,222,,333,,,,333,333', -',333,333,,,,333,,222,,333,,,,222,,222,,222,222,,222,222,222,,222,222', -'222,222,,,222,222,,,222,,,222,,,,,53,53,,222,53,53,53,,,222,,,,222,222', -',222,222,,,,222,,53,,222,,,,53,,53,,53,53,,53,53,53,,53,53,,,,,53,53', -',,53,,,53,,,,,54,54,,53,54,54,54,,,53,,,,53,53,,53,53,,,,53,,54,,53', -',,,54,,54,,54,54,,54,54,54,,54,54,,,,,54,54,,,54,,,54,,,,,55,55,,54', -'55,,55,55,,54,,,,54,54,,54,54,,,,54,,55,,54,,,,55,,55,,55,55,,55,55', -'55,,55,55,,,,,55,55,,,55,,,55,,,,,60,60,,55,60,,60,,,55,,,,55,55,,55', -'55,,,,55,,60,,55,,,,60,,60,,60,60,,60,60,60,,60,60,,,,,60,60,,,60,,', -'60,,,,,229,229,,60,229,,229,229,,60,,,,60,60,,60,60,,,,60,,229,,60,', -',,229,,229,,229,229,,229,229,229,,229,229,229,229,,,229,229,,,229,,', -'229,,,,,155,155,,229,155,,155,155,,229,,,,229,229,,229,229,,,,229,,155', -',229,,,,155,,155,,155,155,,155,155,155,,155,155,155,155,,,155,155,,', -'155,,,155,,,,,65,65,,155,65,,65,,,155,,,,155,155,,155,155,,,,155,,65', -',155,,,,65,,65,,65,65,,65,65,65,,65,65,,,,,65,65,,,65,,,65,,,,,318,318', -',65,318,,318,318,,65,,,,65,65,,65,65,,,,65,,318,,65,,,,318,,318,,318', -'318,,318,318,318,,318,318,318,318,,,318,318,,,318,,,318,,,,,74,74,,318', -'74,,74,,,318,,,,318,318,,318,318,,,,318,,74,,318,,,,74,,74,,74,74,,74', -'74,74,,74,74,74,74,,,74,74,,,74,,,74,,,,,317,317,,74,317,,317,,,74,', -',,74,74,,74,74,,,,74,,317,,74,,,,317,,317,,317,317,,317,317,317,,317', -'317,317,317,,,317,317,,,317,,,317,,,,,76,76,,317,76,,76,,,317,,,,317', -'317,,317,317,,,,317,,76,,317,,,,76,,76,,76,76,,76,76,76,,76,76,76,76', -',,76,76,,,76,,,76,,,,,77,77,,76,77,,77,,,76,,,,76,76,,76,76,,,,76,,77', -',76,,,,77,,77,,77,77,,77,77,77,,77,77,77,77,,,77,77,,,77,,,77,,,,,78', -'78,,77,78,,78,,,77,,,,77,77,,77,77,,,,77,,78,,77,,,,78,,78,,78,78,,78', -'78,78,,78,78,78,78,,,78,78,,,78,,,78,,,,,79,79,,78,79,,79,,,78,,,,78', -'78,,78,78,,,,78,,79,,78,,,,79,,79,,79,79,,79,79,79,,79,79,79,79,,,79', -'79,,,79,,,79,,,,,80,80,,79,80,,80,,,79,,,,79,79,,79,79,,,,79,,80,,79', -',,,80,,80,,80,80,,80,80,80,,80,80,80,80,,,80,80,,,80,,,80,,,,,81,81', -',80,81,,81,,,80,,,,80,80,,80,80,,,,80,,81,,80,,,,81,,81,,81,81,,81,81', -'81,,81,81,,,,,81,81,,,81,,,81,,,,,82,82,,81,82,,82,,,81,,,,81,81,,81', -'81,,,,81,,82,,81,,,,82,,82,,82,82,,82,82,82,,82,82,,,,,82,82,,,82,,', -'82,,,,,83,83,,82,83,,83,,,82,,,,82,82,,82,82,,,,82,,83,,82,,,,83,,83', -',83,83,,83,83,83,,83,83,,,,,83,83,,,83,,,83,,,,,84,84,,83,84,,84,,,83', -',,,83,83,,83,83,,,,83,,84,,83,,,,84,,84,,84,84,,84,84,84,,84,84,,,,', -'84,84,,,84,,,84,,,,,85,85,,84,85,,85,,,84,,,,84,84,,84,84,,,,84,,85', -',84,,,,85,,85,,85,85,,85,85,85,,85,85,,,,,85,85,,,85,,,85,,,,,86,86', -',85,86,,86,,,85,,,,85,85,,85,85,,,,85,,86,,85,,,,86,,86,,86,86,,86,86', -'86,,86,86,,,,,86,86,,,86,,,86,,,,,87,87,,86,87,,87,,,86,,,,86,86,,86', -'86,,,,86,,87,,86,,,,87,,87,,87,87,,87,87,87,,87,87,,,,,87,87,,,87,,', -'87,,,,,88,88,,87,88,,88,,,87,,,,87,87,,87,87,,,,87,,88,,87,,,,88,,88', -',88,88,,88,88,88,,88,88,,,,,88,88,,,88,,,88,,,,,89,89,,88,89,,89,,,88', -',,,88,88,,88,88,,,,88,,89,,88,,,,89,,89,,89,89,,89,89,89,,89,89,,,,', -'89,89,,,89,,,89,,,,,90,90,,89,90,,90,,,89,,,,89,89,,89,89,,,,89,,90', -',89,,,,90,,90,,90,90,,90,90,90,,90,90,,,,,90,90,,,90,,,90,,,,,91,91', -',90,91,,91,,,90,,,,90,90,,90,90,,,,90,,91,,90,,,,91,,91,,91,91,,91,91', -'91,,91,91,,,,,91,91,,,91,,,91,,,,,92,92,,91,92,,92,,,91,,,,91,91,,91', -'91,,,,91,,92,,91,,,,92,,92,,92,92,,92,92,92,,92,92,,,,,92,92,,,92,,', -'92,,,,,93,93,,92,93,,93,,,92,,,,92,92,,92,92,,,,92,,93,,92,,,,93,,93', -',93,93,,93,93,93,,93,93,,,,,93,93,,,93,,,93,,,,,94,94,,93,94,,94,,,93', -',,,93,93,,93,93,,,,93,,94,,93,,,,94,,94,,94,94,,94,94,94,,94,94,,,,', -'94,94,,,94,,,94,,,,,95,95,,94,95,,95,,,94,,,,94,94,,94,94,,,,94,,95', -',94,,,,95,,95,,95,95,,95,95,95,,95,95,,,,,95,95,,,95,,,95,,,,,96,96', -',95,96,,96,,,95,,,,95,95,,95,95,,,,95,,96,,95,,,,96,,96,,96,96,,96,96', -'96,,96,96,,,,,96,96,,,96,,,96,,,,,97,97,,96,97,,97,,,96,,,,96,96,,96', -'96,,,,96,,97,,96,,,,97,,97,,97,97,,97,97,97,,97,97,,,,,97,97,,,97,,', -'97,,,,,98,98,,97,98,,98,,,97,,,,97,97,,97,97,,,,97,,98,,97,,,,98,,98', -',98,98,,98,98,98,,98,98,,,,,98,98,,,98,,,98,,,,,99,99,,98,99,,99,,,98', -',,,98,98,,98,98,,,,98,,99,,98,,,,99,,99,,99,99,,99,99,99,,99,99,,,,', -'99,99,,,99,,,99,,,,,100,100,,99,100,,100,,,99,,,,99,99,,99,99,,,,99', -',100,,99,,,,100,,100,,100,100,,100,100,100,,100,100,,,,,100,100,,,100', -',,100,,,,,101,101,,100,101,,101,,,100,,,,100,100,,100,100,,,,100,,101', -',100,,,,101,,101,,101,101,,101,101,101,,101,101,,,,,101,101,,,101,,', -'101,,,,,102,102,,101,102,,102,,,101,,,,101,101,,101,101,,,,101,,102', -',101,,,,102,,102,,102,102,,102,102,102,,102,102,,,,,102,102,,,102,,', -'102,,,,,103,103,,102,103,,103,,,102,,,,102,102,,102,102,,,,102,,103', -',102,,,,103,,103,,103,103,,103,103,103,,103,103,,,,,103,103,,,103,,', -'103,,,,,306,306,,103,306,,306,306,,103,,,103,103,103,,103,103,,,,103', -',306,,103,,,,306,,306,,306,306,,306,306,306,,306,306,,,,,306,306,,,306', -',,306,,,,,105,105,,306,105,,105,,,306,,,,306,306,,306,306,,,,306,,105', -',306,,,,105,105,105,105,105,105,105,105,105,105,,105,105,,,,,105,105', -'105,105,105,,,105,,,,,299,299,,105,299,,299,,105,105,,,,105,105,,105', -'105,,,,105,,299,,105,,,,299,,299,,299,299,,299,299,299,,299,299,,,,', -'299,299,,,299,,,299,,,,,107,107,,299,107,,107,,,299,,,,299,299,,299', -'299,,,,299,,107,,299,,,,107,,107,,107,107,,107,107,107,,107,107,,,,', -'107,107,,,107,,,107,,,,,108,108,,107,108,,108,,,107,,,,107,107,,107', -'107,,,,107,,108,,107,,,,108,,108,,108,108,,108,108,108,,108,108,,,,', -'108,108,,,108,,,108,,,,,292,292,,108,292,,292,,,108,,,,108,108,,108', -'108,,,,108,,292,,108,,,,292,,292,,292,292,,292,292,292,,292,292,,,,', -'292,292,,,292,,,292,,,,,278,278,,292,278,,278,,,292,,,,292,292,,292', -'292,,,,292,,278,,292,,,,278,,278,,278,278,,278,278,278,,278,278,,,,', -'278,278,,,278,,,278,,,,,277,277,,278,277,,277,,,278,,,,278,278,,278', -'278,,,,278,,277,,278,,,,277,,277,,277,277,,277,277,277,,277,277,,,,', -'277,277,,,277,,,277,,,,,230,230,,277,230,,230,230,,277,,,,277,277,,277', -'277,,,,277,,230,,277,,,,230,,230,,230,230,,230,230,230,,230,230,230', -'230,,,230,230,,,230,,,230,,,,,113,113,,230,113,,113,,,230,,,,230,230', -',230,230,,,,230,,113,113,230,,,,113,,113,,113,113,,113,113,113,,113', -'113,,,,,113,113,,,113,,,113,,,,,274,274,,113,274,,274,,,113,,,,113,113', -',113,113,,,,113,,274,,113,,,,274,,274,,274,274,,274,274,274,,274,274', -',,,,274,274,,,274,,,274,,,,,268,268,,274,268,,268,,,274,,,,274,274,', -'274,274,,,,274,,268,,274,,,,268,,268,,268,268,,268,268,268,,268,268', -',,,,268,268,,,268,,,268,,,,,117,117,,268,117,,117,,,268,,,,268,268,', -'268,268,,,,268,,117,117,268,,,,117,,117,,117,117,,117,117,117,,117,117', -',,,,117,117,,,117,,,117,,,,,152,152,,117,152,,152,,,117,,,,117,117,', -'117,117,,,,117,,152,,117,,,,152,,152,,152,152,,152,152,152,,152,152', -'152,152,,,152,152,,,152,,,152,,,,,231,231,,152,231,,231,,,152,,,,152', -'152,,152,152,,,,152,,231,,152,,,,231,,231,,231,231,,231,231,231,,231', -'231,,,,,231,231,,,231,,,231,,,,,246,246,,231,246,246,246,,,231,,,,231', -'231,,231,231,,,,231,,246,,231,,,,246,,246,,246,246,,246,246,246,,246', -'246,,,,,246,246,,,246,,,246,,,,,233,233,,246,233,,233,,,246,,,,246,246', -',246,246,,,,246,,233,,246,,,,233,,233,,233,233,,233,233,233,,233,233', -',,,,233,233,,,233,,,233,,,,,267,267,,233,267,,267,,,233,,,,233,233,', -'233,233,,,,233,,267,,233,,,,267,,267,,267,267,,267,267,267,,267,267', -',,,,267,267,,,267,,,267,,,,,124,124,,267,124,,124,,,267,,,,267,267,', -'267,267,,,,267,,124,,267,,,,124,,124,,124,124,,124,124,124,,124,124', -',,,,124,124,,,124,,,124,,,,,244,244,,124,244,244,244,,,124,,,,124,124', -',124,124,,,,124,,244,,124,,,,244,,244,,244,244,,244,244,244,,244,244', -',,,,244,244,,,244,,,244,,,,,255,255,,244,255,,255,,,244,,,,244,244,', -'244,244,,,,244,,255,,244,,,,255,,255,,255,255,,255,255,255,,255,255', -',,,,255,255,,,255,,,255,,,,,250,250,,255,250,,250,250,,255,,,,255,255', -',255,255,,,,255,,250,,255,,,,250,,250,,250,250,,250,250,250,,250,250', -',,,,250,250,,,250,,,250,,,,,248,248,,250,248,,248,,,250,,,,250,250,', -'250,250,,,,250,,248,,250,,,,248,,248,,248,248,,248,248,248,,248,248', -',,,,248,248,,,248,,,248,,,,,232,232,,248,232,,232,,,248,,,,248,248,', -'248,248,,204,204,248,,232,,248,,,,232,232,232,232,232,232,232,232,232', -'232,,232,232,,50,50,,232,232,232,232,232,,,232,,,,204,,,204,232,,,,', -'232,232,,,,232,232,,232,232,138,,,232,204,50,,232,50,138,138,138,138', -'138,138,204,138,,138,,,138,138,138,138,,,,50,,,,,,,,,,,50,138,,,,138', -'138,,,138,138,138,138,138,138,,138,138,,,,,264,138,264,,,264,,,,264', -'264,264,264,264,264,,264,,264,138,,264,264,264,264,,,,,,,,,,,,,,,,264', -',,,264,264,,,264,264,264,264,264,264,143,264,264,,,143,,,264,143,143', -'143,143,143,143,,143,,143,,,143,143,143,143,,264,,,,,,,,,,,,,,143,,', -',143,143,,,143,143,143,143,143,143,,143,143,,,,,122,143,122,,,,,,,122', -'122,122,122,122,122,,122,,122,143,,122,122,122,122,,,,,,,,,,,,,,,,122', -',,,122,122,,,122,122,122,122,122,122,147,122,122,,,,,,122,147,147,147', -'147,147,147,,147,,147,,,147,147,147,147,,122,,,,,,,,,,,,,,147,,,,147', -'147,,,147,147,147,147,147,147,,147,147,,,,,121,147,121,,,,,,,121,121', -'121,121,121,121,,121,,121,147,,121,121,121,121,,,,,,,,,,,,,,,,121,,', -',121,121,,,121,121,121,121,121,121,,121,121,,,,,120,121,120,,,,,,,120', -'120,120,120,120,120,,120,,120,121,,120,120,120,120,,,,,,,,,,,,,,,,120', -',,,120,120,,,120,120,120,120,120,120,,120,120,,,,,118,120,118,,,,,,', -'118,118,118,118,118,118,,118,,118,120,,118,118,118,118,,,,,,,,,,,,,', -',,118,,,,118,118,,,118,118,118,118,118,118,112,118,118,,,,,,118,112', -'112,112,112,112,112,,112,,112,,112,112,112,112,112,,118,,,,,,,,,,,,', -',112,,,,112,112,,,112,112,112,112,112,112,154,112,112,,,,,,112,154,154', -'154,154,154,154,,154,,154,,,154,154,154,154,,112,,,,,,,,,,,,,,154,,', -',154,154,,,154,154,154,154,154,154,322,154,154,,,,,,154,322,322,322', -'322,322,322,,322,,322,154,154,322,322,322,322,,154,,,,,,,,,,,,,,322', -',,,322,322,,,322,322,322,322,322,322,325,322,322,,,,,,322,325,325,325', -'325,325,325,,325,,325,,,325,325,325,325,,322,,,,,,,,,,,,,,325,,,,325', -'325,,,325,325,325,325,325,325,331,325,325,,,,,,325,331,331,331,331,331', -'331,,331,,331,,,331,331,331,331,,325,,,,,,,,,,,,,,331,,,,331,331,,,331', -'331,331,331,331,331,214,331,331,,,,,,331,214,214,214,214,214,214,,214', -',214,,,214,214,214,214,,331,,,,,,,,,,,,,,214,,,,214,214,,,214,214,214', -'214,214,214,339,214,214,,,,,,214,339,339,339,339,339,339,,339,,339,', -',339,339,339,339,,214,,,,,,,,,,,,,,339,,,,339,339,,,339,339,339,339', -'339,339,340,339,339,,,,,,339,340,340,340,340,340,340,,340,167,340,,168', -'340,340,340,340,,339,,,,,167,,167,168,167,168,,168,,340,,,,340,340,', -',340,340,340,340,340,340,,340,340,167,,,168,,340,,,,,167,167,172,168', -'168,167,167,,168,168,,,167,340,,168,172,,172,,172,,,,,346,,,,,167,,', -'168,346,346,346,346,346,346,,346,172,346,,,346,346,346,346,172,172,172', -'172,,,,172,172,,,,,,172,346,,,,346,346,,,346,346,346,346,346,346,190', -'346,346,172,,,,,346,190,190,190,190,190,190,190,190,,190,,,190,190,190', -'190,,346,,,,,,,,,,,,,,190,,,,190,190,,,190,190,190,190,190,190,,190', -'190,,,,,11,190,11,,,,,,,11,11,11,11,11,11,,11,173,11,190,,11,11,11,11', -',,,,,,173,,173,,173,,,,,11,,,,11,11,,,11,11,11,11,11,11,,11,11,173,', -',174,,11,,,173,173,173,173,,,,173,173,174,,174,175,174,173,11,,,,,,', -',,,,175,,175,,175,,173,,,174,,,,,,,,174,174,174,174,174,174,,174,174', -'175,,,,,174,,,175,175,175,175,175,175,176,175,175,,,,,,175,174,,,,176', -'176,,176,177,176,,,176,,,,,175,,,,177,177,,177,,177,,,177,,176,,,,,', -',,176,176,176,176,176,176,,176,176,177,,,,,176,,,177,177,177,177,177', -'177,178,177,177,,,,,,177,176,,,,178,178,,178,179,178,,,178,,,,,177,', -',,179,179,,179,,179,,,179,,178,,,,,,,,178,178,178,178,178,178,,178,178', -'179,,,,,178,,,179,179,179,179,179,179,180,179,179,,,,,,179,178,,,180', -'180,180,,180,,180,,181,180,180,180,180,,179,,,,,,181,181,181,,181,,181', -',180,181,181,181,181,,,,180,180,180,180,180,180,,180,180,,,,181,,180', -',,181,,,181,181,181,181,181,181,182,181,181,,,,180,,181,182,182,182', -'182,182,182,,182,,182,,,182,182,182,182,,181,,,,,,,,,,,,,,182,,,,182', -'182,,,182,182,182,182,182,182,185,182,182,,,185,,,182,185,185,185,185', -'185,185,,185,,185,,,185,185,185,185,,182,,,,,,,,,,,,,,185,,,,185,185', -',,185,185,185,185,185,185,184,185,185,,,,,,185,184,184,184,184,184,184', -',184,,184,,,184,184,184,184,,185,,,,,,,,,,,,,,184,,,,184,184,,,184,184', -'184,184,184,184,183,184,184,,,,,,184,183,183,183,183,183,183,,183,170', -'183,,169,183,183,183,183,,184,,,,,170,,170,169,170,169,,169,,183,,,', -'183,183,,171,183,183,183,183,183,183,,183,183,170,,,169,171,183,171', -',171,,,,,,,170,170,,169,169,,,170,183,,169,,,,,171,,,,,,,,,,,,,,,171', -'171,,276,276,276,276,171,276,276,276,276,276,,276,276,,,,,,,276,276', -'276,271,271,271,271,,271,271,271,271,271,,271,271,,,276,276,,,271,271', -'271,213,213,213,213,,213,213,213,213,213,,213,213,,,271,271,,,213,213', -'213,,,,,,,,,,,,,,,,213,213' ] - racc_action_check = arr = ::Array.new(6523, nil) +'0,0,132,202,0,0,238,0,199,306,207,201,228,206,154,238,40,164,306,241', +'241,117,164,241,0,145,228,132,145,315,0,126,0,315,0,0,315,0,0,0,266', +'0,0,0,0,202,235,0,0,154,199,0,207,201,0,206,117,244,241,385,385,241', +'0,385,385,142,385,385,0,140,142,270,0,0,140,0,0,0,205,205,0,241,205', +'385,0,348,204,348,131,385,204,385,241,385,385,49,385,385,385,49,385', +'385,385,385,152,152,385,385,152,274,385,203,111,385,116,203,111,205', +'5,5,205,385,5,5,303,5,303,385,331,331,276,385,385,158,385,385,124,243', +'243,385,205,243,5,385,8,8,8,8,5,227,5,205,5,5,225,5,5,5,5,5,5,5,5,280', +'124,5,5,221,124,5,150,150,5,294,296,298,243,384,384,243,5,384,384,299', +'384,384,5,107,302,236,5,5,304,5,5,46,50,50,5,243,50,384,5,305,220,105', +'309,384,310,384,243,384,384,311,384,384,384,312,384,384,384,384,313', +'46,384,384,218,46,384,317,76,384,74,64,63,50,382,382,50,384,382,382', +'330,382,382,384,134,216,333,384,384,196,384,384,335,47,195,384,50,342', +'382,384,343,41,239,260,382,351,382,50,382,382,352,382,382,382,354,382', +'382,382,382,355,359,382,382,360,361,382,39,367,382,368,371,240,6,189', +'189,1,382,189,189,389,189,393,382,395,397,,382,382,167,382,382,,,,382', +',,189,382,,,,167,189,167,189,167,189,189,,189,189,189,,189,189,,,,,189', +'189,,,189,,,189,167,,,,12,12,,189,12,12,,12,,189,,,,189,189,170,189', +'189,167,,,189,,,12,189,,,,170,12,170,12,170,12,12,,12,12,12,,12,12,', +',,,12,12,,,12,,,12,170,,,,13,13,,12,13,13,,13,,12,,170,170,12,12,171', +'12,12,170,,,12,,,13,12,,,,171,13,171,13,171,13,13,,13,13,13,,13,13,', +',,,13,13,,,13,,,13,171,,,,14,14,,13,14,14,,14,,13,,171,171,13,13,166', +'13,13,171,,,13,,,14,13,,,,166,14,166,14,166,14,14,,14,14,14,,14,14,', +',,,14,14,,,14,,,14,166,,,,363,363,,14,363,363,,363,,14,,,,14,14,172', +'14,14,166,,,14,,,363,14,,,,172,363,172,363,172,363,363,,363,363,363', +',363,363,363,363,,,363,363,,,363,,,363,172,,,,350,350,,363,350,350,', +'350,,363,,172,172,363,363,165,363,363,172,,,363,,,350,363,,,,165,350', +'165,350,165,350,350,,350,350,350,,350,350,,,,,350,350,,,350,,,350,165', +',,,192,192,,350,192,192,,192,,350,,,,350,350,112,350,350,,,,350,,,192', +'350,,,,112,192,112,192,112,192,192,,192,192,192,,192,192,,,,,192,192', +',,192,,,192,112,,,,42,42,,192,42,42,,42,,192,,,,192,192,110,192,192', +',,,192,,,42,192,,,,110,42,110,42,110,42,42,,42,42,42,,42,42,,,,,42,42', +',,42,,,42,110,,,,43,43,,42,43,43,,43,,42,,,,42,42,,42,42,,,,42,,,43', +'42,,,,,43,,43,,43,43,,43,43,43,,43,43,,,,,43,43,,,43,,,43,,,,,44,44', +',43,44,44,,44,,43,,,,43,43,,43,43,,,,43,,,44,43,,,,,44,,44,,44,44,,44', +'44,44,,44,44,,,,,44,44,,,44,,,44,,,,,45,45,,44,45,45,,45,,44,,,,44,44', +',44,44,,,,44,,,45,44,,,,,45,,45,,45,45,,45,45,45,,45,45,,,,,45,45,,', +'45,,,45,,,,,193,193,,45,193,193,,193,,45,,,,45,45,,45,45,,,,45,,,193', +'45,,,,,193,,193,,193,193,,193,193,193,,193,193,,,,,193,193,,,193,,,193', +',,,,194,194,,193,194,194,,194,,193,,,,193,193,,193,193,,,,193,,,194', +'193,,,,,194,,194,,194,194,,194,194,194,,194,194,,,,,194,194,,,194,,', +'194,,,,,334,334,,194,334,334,,334,,194,,,,194,194,,194,194,,,,194,,', +'334,194,,,,,334,,334,,334,334,,334,334,334,,334,334,,,,,334,334,,,334', +',,334,,,,,223,223,,334,223,223,,223,223,334,,,,334,334,,334,334,,,,334', +',,223,334,,,,,223,,223,,223,223,,223,223,223,,223,223,223,223,,,223', +'223,,,223,,,223,,,,,53,53,,223,53,53,53,53,,223,,,,223,223,,223,223', +',,,223,,,53,223,,,,,53,,53,,53,53,,53,53,53,,53,53,,,,,53,53,,,53,,', +'53,,,,,54,54,,53,54,54,54,54,,53,,,,53,53,,53,53,,,,53,,,54,53,,,,,54', +',54,,54,54,,54,54,54,,54,54,,,,,54,54,,,54,,,54,,,,,55,55,,54,55,55', +',55,55,54,,,,54,54,,54,54,,,,54,,,55,54,,,,,55,,55,,55,55,,55,55,55', +',55,55,,,,,55,55,,,55,,,55,,,,,61,61,,55,61,61,,61,,55,,,,55,55,,55', +'55,,,,55,,,61,55,,,,,61,,61,,61,61,,61,61,61,,61,61,,,,,61,61,,,61,', +',61,,,,,230,230,,61,230,230,,230,230,61,,,,61,61,,61,61,,,,61,,,230', +'61,,,,,230,,230,,230,230,,230,230,230,,230,230,230,230,,,230,230,,,230', +',,230,,,,,156,156,,230,156,156,,156,156,230,,,,230,230,,230,230,,,,230', +',,156,230,,,,,156,,156,,156,156,,156,156,156,,156,156,156,156,,,156', +'156,,,156,,,156,,,,,66,66,,156,66,66,,66,,156,,,,156,156,,156,156,,', +',156,,,66,156,,,,,66,,66,,66,66,,66,66,66,,66,66,,,,,66,66,,,66,,,66', +',,,,319,319,,66,319,319,,319,319,66,,,,66,66,,66,66,,,,66,,,319,66,', +',,,319,,319,,319,319,,319,319,319,,319,319,319,319,,,319,319,,,319,', +',319,,,,,75,75,,319,75,75,,75,,319,,,,319,319,,319,319,,,,319,,,75,319', +',,,,75,,75,,75,75,,75,75,75,,75,75,75,75,,,75,75,,,75,,,75,,,,,318,318', +',75,318,318,,318,,75,,,,75,75,,75,75,,,,75,,,318,75,,,,,318,,318,,318', +'318,,318,318,318,,318,318,318,318,,,318,318,,,318,,,318,,,,,77,77,,318', +'77,77,,77,,318,,,,318,318,,318,318,,,,318,,,77,318,,,,,77,,77,,77,77', +',77,77,77,,77,77,77,77,,,77,77,,,77,,,77,,,,,78,78,,77,78,78,,78,,77', +',,,77,77,,77,77,,,,77,,,78,77,,,,,78,,78,,78,78,,78,78,78,,78,78,78', +'78,,,78,78,,,78,,,78,,,,,79,79,,78,79,79,,79,,78,,,,78,78,,78,78,,,', +'78,,,79,78,,,,,79,,79,,79,79,,79,79,79,,79,79,79,79,,,79,79,,,79,,,79', +',,,,80,80,,79,80,80,,80,,79,,,,79,79,,79,79,,,,79,,,80,79,,,,,80,,80', +',80,80,,80,80,80,,80,80,80,80,,,80,80,,,80,,,80,,,,,81,81,,80,81,81', +',81,,80,,,,80,80,,80,80,,,,80,,,81,80,,,,,81,,81,,81,81,,81,81,81,,81', +'81,81,81,,,81,81,,,81,,,81,,,,,82,82,,81,82,82,,82,,81,,,,81,81,,81', +'81,,,,81,,,82,81,,,,,82,,82,,82,82,,82,82,82,,82,82,,,,,82,82,,,82,', +',82,,,,,83,83,,82,83,83,,83,,82,,,,82,82,,82,82,,,,82,,,83,82,,,,,83', +',83,,83,83,,83,83,83,,83,83,,,,,83,83,,,83,,,83,,,,,84,84,,83,84,84', +',84,,83,,,,83,83,,83,83,,,,83,,,84,83,,,,,84,,84,,84,84,,84,84,84,,84', +'84,,,,,84,84,,,84,,,84,,,,,85,85,,84,85,85,,85,,84,,,,84,84,,84,84,', +',,84,,,85,84,,,,,85,,85,,85,85,,85,85,85,,85,85,,,,,85,85,,,85,,,85', +',,,,86,86,,85,86,86,,86,,85,,,,85,85,,85,85,,,,85,,,86,85,,,,,86,,86', +',86,86,,86,86,86,,86,86,,,,,86,86,,,86,,,86,,,,,87,87,,86,87,87,,87', +',86,,,,86,86,,86,86,,,,86,,,87,86,,,,,87,,87,,87,87,,87,87,87,,87,87', +',,,,87,87,,,87,,,87,,,,,88,88,,87,88,88,,88,,87,,,,87,87,,87,87,,,,87', +',,88,87,,,,,88,,88,,88,88,,88,88,88,,88,88,,,,,88,88,,,88,,,88,,,,,89', +'89,,88,89,89,,89,,88,,,,88,88,,88,88,,,,88,,,89,88,,,,,89,,89,,89,89', +',89,89,89,,89,89,,,,,89,89,,,89,,,89,,,,,90,90,,89,90,90,,90,,89,,,', +'89,89,,89,89,,,,89,,,90,89,,,,,90,,90,,90,90,,90,90,90,,90,90,,,,,90', +'90,,,90,,,90,,,,,91,91,,90,91,91,,91,,90,,,,90,90,,90,90,,,,90,,,91', +'90,,,,,91,,91,,91,91,,91,91,91,,91,91,,,,,91,91,,,91,,,91,,,,,92,92', +',91,92,92,,92,,91,,,,91,91,,91,91,,,,91,,,92,91,,,,,92,,92,,92,92,,92', +'92,92,,92,92,,,,,92,92,,,92,,,92,,,,,93,93,,92,93,93,,93,,92,,,,92,92', +',92,92,,,,92,,,93,92,,,,,93,,93,,93,93,,93,93,93,,93,93,,,,,93,93,,', +'93,,,93,,,,,94,94,,93,94,94,,94,,93,,,,93,93,,93,93,,,,93,,,94,93,,', +',,94,,94,,94,94,,94,94,94,,94,94,,,,,94,94,,,94,,,94,,,,,95,95,,94,95', +'95,,95,,94,,,,94,94,,94,94,,,,94,,,95,94,,,,,95,,95,,95,95,,95,95,95', +',95,95,,,,,95,95,,,95,,,95,,,,,96,96,,95,96,96,,96,,95,,,,95,95,,95', +'95,,,,95,,,96,95,,,,,96,,96,,96,96,,96,96,96,,96,96,,,,,96,96,,,96,', +',96,,,,,97,97,,96,97,97,,97,,96,,,,96,96,,96,96,,,,96,,,97,96,,,,,97', +',97,,97,97,,97,97,97,,97,97,,,,,97,97,,,97,,,97,,,,,98,98,,97,98,98', +',98,,97,,,,97,97,,97,97,,,,97,,,98,97,,,,,98,,98,,98,98,,98,98,98,,98', +'98,,,,,98,98,,,98,,,98,,,,,99,99,,98,99,99,,99,,98,,,,98,98,,98,98,', +',,98,,,99,98,,,,,99,,99,,99,99,,99,99,99,,99,99,,,,,99,99,,,99,,,99', +',,,,100,100,,99,100,100,,100,,99,,,,99,99,,99,99,,,,99,,,100,99,,,,', +'100,,100,,100,100,,100,100,100,,100,100,,,,,100,100,,,100,,,100,,,,', +'101,101,,100,101,101,,101,,100,,,,100,100,,100,100,,,,100,,,101,100', +',,,,101,,101,,101,101,,101,101,101,,101,101,,,,,101,101,,,101,,,101', +',,,,102,102,,101,102,102,,102,,101,,,,101,101,,101,101,,,,101,,,102', +'101,,,,,102,,102,,102,102,,102,102,102,,102,102,,,,,102,102,,,102,,', +'102,,,,,103,103,,102,103,103,,103,,102,,,,102,102,,102,102,,,,102,,', +'103,102,,,,,103,,103,,103,103,,103,103,103,,103,103,,,,,103,103,,,103', +',,103,,,,,104,104,,103,104,104,,104,,103,,,,103,103,,103,103,,,,103', +',,104,103,,,,,104,,104,,104,104,,104,104,104,,104,104,,,,,104,104,,', +'104,,,104,,,,,307,307,,104,307,307,,307,307,104,,,104,104,104,,104,104', +',,,104,,,307,104,,,,,307,,307,,307,307,,307,307,307,,307,307,,,,,307', +'307,,,307,,,307,,,,,106,106,,307,106,106,,106,,307,,,,307,307,,307,307', +',,,307,,,106,307,,,,,106,106,106,106,106,106,106,106,106,106,,106,106', +',,,,106,106,106,106,106,,,106,,,,,300,300,,106,300,300,,300,106,106', +',,,106,106,,106,106,,,,106,,,300,106,,,,,300,,300,,300,300,,300,300', +'300,,300,300,,,,,300,300,,,300,,,300,,,,,108,108,,300,108,108,,108,', +'300,,,,300,300,,300,300,,,,300,,,108,300,,,,,108,,108,,108,108,,108', +'108,108,,108,108,,,,,108,108,,,108,,,108,,,,,109,109,,108,109,109,,109', +',108,,,,108,108,,108,108,,,,108,,,109,108,,,,,109,,109,,109,109,,109', +'109,109,,109,109,,,,,109,109,,,109,,,109,,,,,293,293,,109,293,293,,293', +',109,,,,109,109,,109,109,,,,109,,,293,109,,,,,293,,293,,293,293,,293', +'293,293,,293,293,,,,,293,293,,,293,,,293,,,,,279,279,,293,279,279,,279', +',293,,,,293,293,,293,293,,,,293,,,279,293,,,,,279,,279,,279,279,,279', +'279,279,,279,279,,,,,279,279,,,279,,,279,,,,,278,278,,279,278,278,,278', +',279,,,,279,279,,279,279,,,,279,,,278,279,,,,,278,,278,,278,278,,278', +'278,278,,278,278,,,,,278,278,,,278,,,278,,,,,231,231,,278,231,231,,231', +'231,278,,,,278,278,168,278,278,,,,278,,,231,278,,,,168,231,168,231,168', +'231,231,,231,231,231,,231,231,231,231,,,231,231,,,231,,,231,168,,,,', +',,231,,,168,168,,231,,168,168,231,231,,231,231,168,114,114,231,,114', +'114,231,114,,,,,,,,,,168,,,,,,,114,114,,,,,114,,114,,114,114,,114,114', +'114,,114,114,,,,,114,114,,,114,,,114,,,,,275,275,,114,275,275,,275,', +'114,,,,114,114,,114,114,,,,114,,,275,114,,,,,275,,275,,275,275,,275', +'275,275,,275,275,,,,,275,275,,,275,,,275,,,,,269,269,,275,269,269,,269', +',275,,,,275,275,169,275,275,,,,275,,,269,275,,,,169,269,169,269,169', +'269,269,,269,269,269,,269,269,,,,,269,269,,,269,,,269,169,,,,,,,269', +',,169,169,,269,,169,169,269,269,,269,269,169,118,118,269,,118,118,269', +'118,,,,,,,,,,169,,,,,,,118,118,,,,,118,,118,,118,118,,118,118,118,,118', +'118,,,,,118,118,,,118,,,118,,,,,153,153,,118,153,153,,153,,118,,,,118', +'118,,118,118,,,,118,,,153,118,,,,,153,,153,,153,153,,153,153,153,,153', +'153,153,153,,,153,153,,,153,,,153,,,,,232,232,,153,232,232,,232,,153', +',,,153,153,,153,153,,,,153,,,232,153,,,,,232,,232,,232,232,,232,232', +'232,,232,232,,,,,232,232,,,232,,,232,,,,,247,247,,232,247,247,247,247', +',232,,,,232,232,,232,232,,,,232,,,247,232,,,,,247,,247,,247,247,,247', +'247,247,,247,247,,,,,247,247,,,247,,,247,,,,,234,234,,247,234,234,,234', +',247,,,,247,247,,247,247,,,,247,,,234,247,,,,,234,,234,,234,234,,234', +'234,234,,234,234,,,,,234,234,,,234,,,234,,,,,268,268,,234,268,268,,268', +',234,,,,234,234,,234,234,,,,234,,,268,234,,,,,268,,268,,268,268,,268', +'268,268,,268,268,,,,,268,268,,,268,,,268,,,,,125,125,,268,125,125,,125', +',268,,,,268,268,,268,268,,,,268,,,125,268,,,,,125,,125,,125,125,,125', +'125,125,,125,125,,,,,125,125,,,125,,,125,,,,,245,245,,125,245,245,245', +'245,,125,,,,125,125,,125,125,,,,125,,,245,125,,,,,245,,245,,245,245', +',245,245,245,,245,245,,,,,245,245,,,245,,,245,,,,,256,256,,245,256,256', +',256,,245,,,,245,245,,245,245,,,,245,,,256,245,,,,,256,,256,,256,256', +',256,256,256,,256,256,,,,,256,256,,,256,,,256,,,,,251,251,,256,251,251', +',251,251,256,,,,256,256,,256,256,,,,256,,,251,256,,,,,251,,251,,251', +'251,,251,251,251,,251,251,,,,,251,251,,,251,,,251,,,,,249,249,,251,249', +'249,,249,,251,,,,251,251,,251,251,,,,251,,,249,251,,,,,249,,249,,249', +'249,,249,249,249,,249,249,,,,,249,249,,,249,,,249,,,,,233,233,,249,233', +'233,,233,,249,,,,249,249,,249,249,,,,249,,,233,249,,,,,233,233,233,233', +'233,233,233,233,233,233,,233,233,,,,,233,233,233,233,233,,,233,,,,,', +',,233,,,,,233,233,,,,233,233,,233,233,139,,,233,,,,233,,139,139,139', +'139,139,139,,139,,139,,,139,139,139,139,,,,,,,,,,,,,,,,139,,,,139,139', +',,139,139,139,139,139,139,,139,139,,,,,265,139,265,,,265,,,,265,265', +'265,265,265,265,,265,,265,139,,265,265,265,265,,,,,,,,,,,,,,,,265,,', +',265,265,,,265,265,265,265,265,265,144,265,265,,,144,,,265,144,144,144', +'144,144,144,,144,,144,,,144,144,144,144,,265,,,,,,,,,,,,,,144,,,,144', +'144,,,144,144,144,144,144,144,,144,144,,,,,123,144,123,,,,,,,123,123', +'123,123,123,123,,123,,123,144,,123,123,123,123,,,,,,,,,,,,,,,,123,,', +',123,123,,,123,123,123,123,123,123,148,123,123,,,,,,123,148,148,148', +'148,148,148,,148,,148,,,148,148,148,148,,123,,,,,,,,,,,,,,148,,,,148', +'148,,,148,148,148,148,148,148,,148,148,,,,,122,148,122,,,,,,,122,122', +'122,122,122,122,,122,,122,148,,122,122,122,122,,,,,,,,,,,,,,,,122,,', +',122,122,,,122,122,122,122,122,122,,122,122,,,,,121,122,121,,,,,,,121', +'121,121,121,121,121,,121,,121,122,,121,121,121,121,,,,,,,,,,,,,,,,121', +',,,121,121,,,121,121,121,121,121,121,,121,121,,,,,119,121,119,,,,,,', +'119,119,119,119,119,119,,119,,119,121,,119,119,119,119,,,,,,,,,,,,,', +',,119,,,,119,119,,,119,119,119,119,119,119,113,119,119,,,,,,119,113', +'113,113,113,113,113,,113,,113,,113,113,113,113,113,,119,,,,,,,,,,,,', +',113,,,,113,113,,,113,113,113,113,113,113,155,113,113,,,,,,113,155,155', +'155,155,155,155,,155,,155,,,155,155,155,155,,113,,,,,,,,,,,,,,155,,', +',155,155,,,155,155,155,155,155,155,323,155,155,,,,,,155,323,323,323', +'323,323,323,,323,,323,155,155,323,323,323,323,,155,,,,,,,,,,,,,,323', +',,,323,323,,,323,323,323,323,323,323,326,323,323,,,,,,323,326,326,326', +'326,326,326,,326,,326,,,326,326,326,326,,323,,,,,,,,,,,,,,326,,,,326', +'326,,,326,326,326,326,326,326,332,326,326,,,,,,326,332,332,332,332,332', +'332,,332,,332,,,332,332,332,332,,326,,,,,,,,,,,,,,332,,,,332,332,,,332', +'332,332,332,332,332,215,332,332,,,,,,332,215,215,215,215,215,215,,215', +',215,,,215,215,215,215,,332,,,,,,,,,,,,,,215,,,,215,215,,,215,215,215', +'215,215,215,340,215,215,,,,,,215,340,340,340,340,340,340,,340,,340,', +',340,340,340,340,,215,,,,,,,,,,,,,,340,,,,340,340,,,340,340,340,340', +'340,340,341,340,340,,,,,,340,341,341,341,341,341,341,,341,,341,,,341', +'341,341,341,,340,,,,,,,,,,,,,,341,,,,341,341,,,341,341,341,341,341,341', +'347,341,341,,,,,,341,347,347,347,347,347,347,,347,,347,,,347,347,347', +'347,,341,,,,,,,,,,,,,,347,,,,347,347,,,347,347,347,347,347,347,191,347', +'347,,,,,,347,191,191,191,191,191,191,191,191,,191,,,191,191,191,191', +',347,,,,,,,,,,,,,,191,,,,191,191,,,191,191,191,191,191,191,,191,191', +',,,,11,191,11,,,,,,,11,11,11,11,11,11,,11,173,11,191,,11,11,11,11,,', +',,,,173,,173,,173,,,,,11,,,,11,11,,,11,11,11,11,11,11,,11,11,173,,,174', +',11,,,173,173,173,173,,,,173,173,174,,174,175,174,173,11,,,,,,,,,,,175', +',175,,175,,173,,,174,,,,,,,,174,174,174,174,,,,174,174,175,,,176,,174', +',,175,175,175,175,175,175,,175,175,176,,176,177,176,175,174,,,,,,,,', +',177,177,,177,,177,,175,177,,176,,,,,,,,176,176,176,176,176,176,,176', +'176,177,,,,,176,,,177,177,177,177,177,177,178,177,177,,,,,,177,176,', +',,178,178,,178,179,178,,,178,,,,,177,,,,179,179,,179,,179,,,179,,178', +',,,,,,,178,178,178,178,178,178,,178,178,179,,,,,178,,,179,179,179,179', +'179,179,180,179,179,,,,,,179,178,,,,180,180,,180,,180,,181,180,,,,,179', +',,,,,181,181,181,,181,,181,,180,181,181,181,181,,,,180,180,180,180,180', +'180,,180,180,,,,181,,180,,,182,,,181,181,181,181,181,181,,181,181,182', +'182,182,180,182,181,182,,183,182,182,182,182,,,,,183,183,183,183,183', +'183,181,183,,183,,182,183,183,183,183,182,,,182,182,182,182,182,182', +',182,182,,,,183,,182,,183,183,,,183,183,183,183,183,183,186,183,183', +',,186,182,,183,186,186,186,186,186,186,,186,,186,,,186,186,186,186,', +'183,,,,,,,,,,,,,,186,,,,186,186,,,186,186,186,186,186,186,185,186,186', +',,,,,186,185,185,185,185,185,185,,185,,185,,,185,185,185,185,,186,,', +',,,,,,,,,,,185,,,,185,185,,,185,185,185,185,185,185,184,185,185,,,,', +',185,184,184,184,184,184,184,,184,,184,,,184,184,184,184,,185,,,,,,', +',,,,,,,184,,,,184,184,,,184,184,184,184,184,184,,184,184,,277,277,277', +'277,184,277,277,277,277,277,,277,277,,,,,,,277,277,277,184,272,272,272', +'272,,272,272,272,272,272,,272,272,,277,277,,,,272,272,272,214,214,214', +'214,,214,214,214,214,214,,214,214,,,272,272,,,214,214,214,,,,,,,,,,', +',,,,,214,214' ] + racc_action_check = arr = ::Array.new(6559, nil) idx = 0 clist.each do |str| str.split(',', -1).each do |i| arr[idx] = i.to_i unless i.empty? idx += 1 end end racc_action_pointer = [ - -2, 292, nil, nil, nil, 114, 277, nil, 106, nil, - nil, 5820, 346, 404, 462, nil, nil, nil, nil, nil, + -2, 297, nil, nil, nil, 116, 281, nil, 79, nil, + nil, 5901, 352, 411, 470, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 258, - 190, 227, 694, 752, 810, 868, 70, 199, nil, 44, - 4739, nil, nil, 1158, 1216, 1274, nil, nil, nil, nil, - 1332, nil, 153, 156, nil, 1506, nil, nil, nil, nil, - nil, nil, nil, 225, 1622, 211, 1738, 1796, 1854, 1912, - 1970, 2028, 2086, 2144, 2202, 2260, 2318, 2376, 2434, 2492, - 2550, 2608, 2666, 2724, 2782, 2840, 2898, 2956, 3014, 3072, - 3130, 3188, 3246, 3304, 161, 3420, 176, 3536, 3594, 350, - 73, 292, 5235, 3884, nil, 119, -15, 4058, 5181, nil, - 5120, 5059, 4944, 20, 4406, -7, nil, nil, nil, nil, - 77, -7, nil, 169, nil, nil, nil, nil, 4768, 20, - nil, 7, nil, 4883, 73, nil, nil, 4998, nil, 156, - nil, 141, 4116, -22, 5289, 1448, nil, 123, nil, nil, - nil, nil, nil, 61, 234, 118, 176, 5630, 5633, 6349, - 6346, 6376, 5682, 5837, 5880, 5897, 5951, 5968, 6022, 6039, - 6093, 6113, 6167, 6329, 6275, 6221, nil, nil, 288, nil, - 5759, 636, 926, 984, 206, 225, nil, nil, -8, nil, - -2, -9, 67, -1, 4715, -1, -4, nil, nil, nil, - nil, nil, nil, 6453, 5505, 184, nil, 195, nil, 182, - 95, nil, 1100, nil, 136, nil, 131, -4, nil, 1390, - 3826, 4174, 4696, 4290, 74, 193, nil, -14, 251, 85, - 23, nil, 14, 248, 4464, nil, 4232, nil, 4638, nil, - 4580, nil, nil, nil, nil, 4522, nil, nil, nil, 201, - nil, nil, nil, nil, 4829, 81, nil, 4348, 4000, 100, - nil, 6431, nil, 114, 3942, 122, 6409, 3768, 3710, 139, - nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 3652, 141, nil, 159, nil, 106, 144, 3478, - nil, 176, 102, 183, 161, 3, 3362, nil, 161, 192, - 165, 200, 3, nil, 78, nil, 207, 1680, 1564, nil, - nil, nil, 5343, nil, nil, 5397, nil, nil, nil, 159, - -10, 5451, 225, 1042, 230, nil, nil, nil, nil, 5559, - 5613, 241, 181, nil, nil, nil, 5705, 94, nil, 578, - 254, 232, nil, 259, 263, nil, nil, nil, 267, 268, - 272, nil, 520, nil, nil, nil, 258, 277, nil, nil, - 278, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 230, nil, 172, 56, nil, nil, nil, 286, nil, - nil, nil, 288, nil, 291, nil, 292, nil, nil, nil, - nil, nil ] + nil, nil, nil, nil, nil, nil, nil, nil, nil, 262, + -55, 237, 706, 765, 824, 883, 186, 210, nil, 58, + 194, nil, nil, 1178, 1237, 1296, nil, nil, nil, nil, + nil, 1355, nil, 158, 162, nil, 1532, nil, nil, nil, + nil, nil, nil, nil, 232, 1650, 217, 1768, 1827, 1886, + 1945, 2004, 2063, 2122, 2181, 2240, 2299, 2358, 2417, 2476, + 2535, 2594, 2653, 2712, 2771, 2830, 2889, 2948, 3007, 3066, + 3125, 3184, 3243, 3302, 3361, 164, 3479, 178, 3597, 3656, + 716, 75, 657, 5354, 3970, nil, 105, -15, 4166, 5300, + nil, 5239, 5178, 5063, 127, 4520, 5, nil, nil, nil, + nil, 62, -11, nil, 225, nil, nil, nil, nil, 4887, + 61, nil, 57, nil, 5002, 15, nil, nil, 5117, nil, + 166, nil, 102, 4225, -22, 5408, 1473, nil, 120, nil, + nil, nil, nil, nil, 9, 598, 480, 303, 3902, 4098, + 362, 421, 539, 5918, 5961, 5978, 6021, 6038, 6092, 6109, + 6163, 6183, 6228, 6248, 6410, 6356, 6302, nil, nil, 293, + nil, 5840, 647, 942, 1001, 214, 238, nil, nil, -4, + nil, -1, -9, 74, 49, 76, 1, -2, nil, nil, + nil, nil, nil, nil, 6488, 5624, 199, nil, 202, nil, + 191, 96, nil, 1119, nil, 141, nil, 133, -1, nil, + 1414, 3892, 4284, 4815, 4402, 4, 151, nil, -21, 255, + 284, 17, nil, 135, 16, 4579, nil, 4343, nil, 4756, + nil, 4697, nil, nil, nil, nil, 4638, nil, nil, nil, + 252, nil, nil, nil, nil, 4948, 30, nil, 4461, 4088, + 58, nil, 6466, nil, 99, 4029, 120, 6443, 3833, 3774, + 150, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 3715, 146, nil, 164, nil, 104, 147, + 3538, nil, 178, 91, 182, 170, -4, 3420, nil, 164, + 195, 171, 207, 213, nil, -8, nil, 216, 1709, 1591, + nil, nil, nil, 5462, nil, nil, 5516, nil, nil, nil, + 171, 48, 5570, 238, 1060, 241, nil, nil, nil, nil, + 5678, 5732, 249, 191, nil, nil, nil, 5786, 52, nil, + 588, 258, 239, nil, 267, 272, nil, nil, nil, 272, + 275, 276, nil, 529, nil, nil, nil, 262, 281, nil, + nil, 282, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 234, nil, 175, 57, nil, nil, nil, 291, + nil, nil, nil, 293, nil, 295, nil, 296, nil, nil, + nil, nil, nil ] racc_action_default = [ - -229, -230, -1, -2, -3, -4, -5, -8, -10, -11, - -16, -108, -230, -230, -230, -45, -46, -47, -48, -49, + -230, -231, -1, -2, -3, -4, -5, -8, -10, -11, + -16, -108, -231, -231, -231, -45, -46, -47, -48, -49, -50, -51, -52, -53, -54, -55, -56, -57, -58, -59, -60, -61, -62, -63, -64, -65, -66, -67, -68, -73, - -74, -78, -230, -230, -230, -230, -230, -119, -121, -230, - -230, -157, -167, -230, -230, -230, -180, -181, -182, -183, - -230, -185, -230, -196, -199, -230, -204, -205, -206, -207, - -208, -209, -210, -230, -230, -7, -230, -230, -230, -230, - -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, - -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, - -230, -230, -230, -230, -230, -128, -123, -229, -229, -28, - -230, -35, -230, -230, -75, -230, -230, -230, -230, -85, - -230, -230, -230, -230, -230, -229, -138, -158, -159, -120, - -229, -229, -147, -149, -150, -151, -152, -153, -43, -230, - -170, -230, -173, -230, -230, -176, -177, -189, -184, -230, - -192, -230, -230, -230, -230, -230, 402, -6, -9, -12, - -13, -14, -15, -230, -18, -19, -20, -21, -22, -23, - -24, -25, -26, -27, -29, -30, -31, -32, -33, -34, - -36, -37, -38, -39, -40, -230, -41, -103, -230, -79, - -230, -222, -228, -216, -213, -211, -117, -129, -205, -132, - -209, -230, -219, -217, -225, -207, -208, -215, -220, -221, - -223, -224, -226, -128, -127, -230, -126, -230, -42, -211, - -70, -80, -230, -83, -211, -163, -166, -230, -77, -230, - -230, -230, -128, -230, -213, -229, -160, -230, -230, -230, - -230, -155, -230, -230, -230, -168, -230, -171, -230, -174, - -230, -186, -187, -188, -190, -230, -193, -194, -195, -211, - -197, -200, -202, -203, -108, -230, -17, -230, -230, -211, - -105, -128, -116, -230, -214, -230, -212, -230, -230, -211, - -131, -133, -216, -217, -218, -219, -222, -225, -227, -228, - -124, -125, -212, -230, -72, -230, -82, -230, -212, -230, - -76, -230, -88, -230, -94, -230, -230, -98, -213, -211, - -213, -230, -230, -141, -230, -161, -211, -229, -230, -148, - -156, -154, -44, -169, -172, -179, -175, -178, -191, -230, - -230, -107, -230, -212, -211, -111, -118, -112, -130, -134, - -135, -230, -69, -81, -84, -164, -165, -88, -87, -230, - -230, -94, -93, -230, -230, -102, -97, -99, -230, -230, - -230, -114, -229, -142, -143, -144, -230, -230, -139, -140, - -230, -146, -198, -201, -104, -106, -115, -122, -71, -86, - -89, -230, -92, -230, -230, -109, -110, -113, -230, -162, - -136, -145, -230, -91, -230, -96, -230, -101, -137, -90, - -95, -100 ] + -74, -78, -231, -231, -231, -231, -231, -119, -121, -231, + -231, -157, -167, -231, -231, -231, -180, -181, -182, -183, + -184, -231, -186, -231, -197, -200, -231, -205, -206, -207, + -208, -209, -210, -211, -231, -231, -7, -231, -231, -231, + -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, + -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, + -231, -231, -231, -231, -231, -231, -128, -123, -230, -230, + -28, -231, -35, -231, -231, -75, -231, -231, -231, -231, + -85, -231, -231, -231, -231, -231, -230, -138, -158, -159, + -120, -230, -230, -147, -149, -150, -151, -152, -153, -43, + -231, -170, -231, -173, -231, -231, -176, -177, -190, -185, + -231, -193, -231, -231, -231, -231, -231, 403, -6, -9, + -12, -13, -14, -15, -231, -18, -19, -20, -21, -22, + -23, -24, -25, -26, -27, -29, -30, -31, -32, -33, + -34, -36, -37, -38, -39, -40, -231, -41, -103, -231, + -79, -231, -223, -229, -217, -214, -212, -117, -129, -206, + -132, -210, -231, -220, -218, -226, -208, -209, -216, -221, + -222, -224, -225, -227, -128, -127, -231, -126, -231, -42, + -212, -70, -80, -231, -83, -212, -163, -166, -231, -77, + -231, -231, -231, -128, -231, -214, -230, -160, -231, -231, + -231, -231, -155, -231, -231, -231, -168, -231, -171, -231, + -174, -231, -187, -188, -189, -191, -231, -194, -195, -196, + -212, -198, -201, -203, -204, -108, -231, -17, -231, -231, + -212, -105, -128, -116, -231, -215, -231, -213, -231, -231, + -212, -131, -133, -217, -218, -219, -220, -223, -226, -228, + -229, -124, -125, -213, -231, -72, -231, -82, -231, -213, + -231, -76, -231, -88, -231, -94, -231, -231, -98, -214, + -212, -214, -231, -231, -141, -231, -161, -212, -230, -231, + -148, -156, -154, -44, -169, -172, -179, -175, -178, -192, + -231, -231, -107, -231, -213, -212, -111, -118, -112, -130, + -134, -135, -231, -69, -81, -84, -164, -165, -88, -87, + -231, -231, -94, -93, -231, -231, -102, -97, -99, -231, + -231, -231, -114, -230, -142, -143, -144, -231, -231, -139, + -140, -231, -146, -199, -202, -104, -106, -115, -122, -71, + -86, -89, -231, -92, -231, -231, -109, -110, -113, -231, + -162, -136, -145, -231, -91, -231, -96, -231, -101, -137, + -90, -95, -100 ] racc_goto_table = [ - 2, 114, 4, 130, 109, 111, 112, 148, 136, 134, - 261, 187, 195, 194, 224, 273, 352, 367, 186, 235, - 348, 215, 217, 307, 238, 159, 160, 161, 162, 319, - 158, 320, 234, 75, 118, 120, 121, 122, 336, 271, - 275, 354, 338, 139, 141, 138, 138, 143, 269, 306, - 380, 259, 147, 312, 363, 311, 239, 154, 221, 345, - 327, 256, 388, 382, 293, 379, 257, 3, 254, 297, - 255, 163, 253, 138, 164, 165, 166, 167, 168, 169, + 2, 115, 4, 131, 110, 112, 113, 149, 137, 274, + 196, 262, 188, 135, 195, 225, 353, 236, 187, 368, + 349, 320, 239, 321, 308, 160, 161, 162, 163, 216, + 218, 159, 337, 235, 119, 121, 122, 123, 276, 76, + 272, 355, 140, 142, 339, 139, 139, 144, 270, 312, + 307, 381, 260, 148, 313, 364, 240, 222, 155, 346, + 328, 257, 294, 383, 389, 380, 258, 298, 3, 255, + 256, 164, 254, 151, 139, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 270, 190, 357, 214, - 214, 150, 157, 219, 329, 138, 152, 227, 1, 138, - nil, nil, nil, nil, 332, nil, 190, nil, nil, nil, - 279, nil, nil, nil, 341, nil, nil, 236, nil, 358, - nil, 360, 236, 241, nil, 316, nil, nil, nil, 309, - 308, 310, nil, nil, nil, nil, nil, 264, nil, nil, - nil, nil, 258, nil, 359, 265, 130, nil, nil, nil, - nil, 366, 136, 134, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 334, 376, - 185, 294, nil, 118, 120, 121, 373, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 136, 134, - 136, 134, 328, nil, nil, nil, nil, nil, nil, nil, + 180, 181, 182, 183, 184, 185, 186, 271, 191, 358, + 215, 215, 330, 220, 153, 1, 139, 228, nil, 158, + 139, nil, 333, nil, nil, nil, nil, 191, 280, nil, + nil, nil, 342, 359, nil, 361, nil, nil, 237, nil, + nil, nil, nil, 237, 242, nil, 317, 310, nil, nil, + nil, 309, 311, nil, nil, nil, nil, nil, 265, nil, + nil, nil, 360, 259, nil, nil, 266, 131, nil, 367, + nil, nil, nil, 137, nil, nil, nil, nil, 135, nil, + nil, nil, nil, nil, nil, nil, 335, 377, nil, nil, + nil, 186, 295, nil, 119, 121, 122, 374, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 137, + nil, 137, 329, nil, 135, nil, 135, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, 296, 139, 191, 191, nil, nil, nil, + 302, 304, nil, nil, nil, nil, nil, 323, 314, 323, + nil, 326, 376, 144, nil, nil, nil, nil, 148, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 295, 138, 190, 190, nil, nil, nil, 301, - 303, nil, nil, nil, nil, nil, 322, 313, 322, nil, - 325, 375, 143, nil, nil, nil, nil, 147, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 322, - 331, nil, nil, nil, nil, nil, 190, nil, 364, 339, - 340, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 322, nil, nil, nil, nil, nil, - nil, 346, nil, nil, nil, nil, nil, nil, 138, nil, - nil, nil, nil, 378, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 370, 369, - nil, nil, nil, nil, nil, 185, nil, nil, nil, nil, + 323, 332, nil, nil, nil, nil, nil, 191, nil, 365, + 340, 341, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 323, nil, nil, nil, nil, + nil, nil, 347, nil, nil, nil, nil, nil, nil, 139, + nil, nil, nil, nil, 379, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 371, + 370, nil, nil, nil, nil, nil, 186, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 118, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 119, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 369, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 370, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 392, nil, 394, 396 ] + nil, nil, 393, nil, 395, 397 ] racc_goto_check = [ - 2, 40, 4, 65, 10, 10, 10, 82, 32, 38, - 89, 52, 57, 55, 45, 56, 48, 67, 13, 66, - 47, 61, 61, 50, 66, 8, 8, 8, 8, 73, - 7, 73, 55, 6, 10, 10, 10, 10, 58, 59, - 39, 51, 62, 12, 12, 10, 10, 10, 53, 49, - 46, 45, 10, 69, 70, 56, 72, 10, 44, 75, - 77, 78, 67, 48, 39, 47, 79, 3, 83, 39, - 84, 12, 86, 10, 10, 10, 10, 10, 10, 10, + 2, 40, 4, 65, 10, 10, 10, 82, 32, 56, + 57, 89, 52, 38, 55, 45, 48, 66, 13, 67, + 47, 73, 66, 73, 50, 8, 8, 8, 8, 61, + 61, 7, 58, 55, 10, 10, 10, 10, 39, 6, + 59, 51, 12, 12, 62, 10, 10, 10, 53, 56, + 49, 46, 45, 10, 69, 70, 72, 44, 10, 75, + 77, 78, 39, 48, 67, 47, 79, 39, 3, 83, + 84, 12, 86, 87, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 52, 10, 50, 10, - 10, 87, 6, 12, 39, 10, 88, 12, 1, 10, - nil, nil, nil, nil, 39, nil, 10, nil, nil, nil, - 57, nil, nil, nil, 39, nil, nil, 4, nil, 56, - nil, 56, 4, 4, nil, 45, nil, nil, nil, 57, - 55, 55, nil, nil, nil, nil, nil, 10, nil, nil, - nil, nil, 2, nil, 39, 2, 65, nil, nil, nil, - nil, 39, 32, 38, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 57, 39, - 10, 40, nil, 10, 10, 10, 89, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 32, 38, - 32, 38, 82, nil, nil, nil, nil, nil, nil, nil, + 10, 10, 10, 10, 10, 10, 10, 52, 10, 50, + 10, 10, 39, 12, 88, 1, 10, 12, nil, 6, + 10, nil, 39, nil, nil, nil, nil, 10, 57, nil, + nil, nil, 39, 56, nil, 56, nil, nil, 4, nil, + nil, nil, nil, 4, 4, nil, 45, 57, nil, nil, + nil, 55, 55, nil, nil, nil, nil, nil, 10, nil, + nil, nil, 39, 2, nil, nil, 2, 65, nil, 39, + nil, nil, nil, 32, nil, nil, nil, nil, 38, nil, + nil, nil, nil, nil, nil, nil, 57, 39, nil, nil, + nil, 10, 40, nil, 10, 10, 10, 89, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 32, + nil, 32, 82, nil, 38, nil, 38, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, 2, 10, 10, 10, nil, nil, nil, 2, - 2, nil, nil, nil, nil, nil, 10, 4, 10, nil, - 10, 52, 10, nil, nil, nil, nil, 10, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, nil, 10, - 10, nil, nil, nil, nil, nil, 10, nil, 65, 10, - 10, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 10, nil, nil, nil, nil, nil, - nil, 10, nil, nil, nil, nil, nil, nil, 10, nil, - nil, nil, nil, 40, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, nil, nil, nil, nil, 2, 4, + nil, nil, nil, 2, 10, 10, 10, nil, nil, nil, + 2, 2, nil, nil, nil, nil, nil, 10, 4, 10, + nil, 10, 52, 10, nil, nil, nil, nil, 10, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, + 10, 10, nil, nil, nil, nil, nil, 10, nil, 65, + 10, 10, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 10, nil, nil, nil, nil, + nil, nil, 10, nil, nil, nil, nil, nil, nil, 10, + nil, nil, nil, nil, 40, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, nil, nil, nil, nil, 2, + 4, nil, nil, nil, nil, nil, 10, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 10, nil, nil, nil, nil, nil, nil, nil, nil, + nil, nil, 10, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, nil, nil, 4, nil, nil, nil, nil, nil, + nil, nil, nil, nil, nil, 4, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, 2, nil, 2, 2 ] + nil, nil, 2, nil, 2, 2 ] racc_goto_pointer = [ - nil, 108, 0, 67, 2, nil, 28, -46, -52, nil, - -8, nil, -10, -85, nil, nil, nil, nil, nil, nil, + nil, 105, 0, 68, 2, nil, 34, -46, -53, nil, + -8, nil, -11, -86, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, - nil, nil, -42, nil, nil, nil, nil, nil, -41, -155, - -39, nil, nil, nil, -57, -102, -299, -282, -288, -182, - -208, -264, -92, -140, nil, -92, -179, -93, -236, -151, - nil, -86, -234, nil, nil, -46, -106, -300, nil, -182, - -260, nil, -75, -211, nil, -239, nil, -190, -90, -85, - nil, nil, -53, -81, -79, nil, -77, 39, 43, -144 ] + nil, nil, -42, nil, nil, nil, nil, nil, -37, -158, + -39, nil, nil, nil, -59, -102, -299, -283, -289, -182, + -208, -265, -92, -141, nil, -92, -186, -96, -243, -151, + nil, -79, -233, nil, nil, -46, -109, -299, nil, -182, + -260, nil, -76, -220, nil, -240, nil, -191, -91, -86, + nil, nil, -54, -81, -80, nil, -78, 10, 40, -144 ] racc_goto_default = [ - nil, nil, 368, nil, 216, 5, 6, 7, 8, 9, - 11, 10, 305, nil, 15, 39, 16, 17, 18, 19, + nil, nil, 369, nil, 217, 5, 6, 7, 8, 9, + 11, 10, 306, nil, 15, 39, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, nil, - nil, 40, 41, 115, nil, nil, 119, nil, nil, nil, - nil, nil, nil, nil, 45, nil, nil, nil, 196, nil, - 106, nil, 197, 201, 199, 126, nil, nil, 125, nil, - nil, 131, nil, 132, 133, 225, 144, 146, 56, 57, - 58, 60, nil, nil, nil, 149, nil, nil, nil, nil ] + nil, 40, 41, 116, nil, nil, 120, nil, nil, nil, + nil, nil, nil, nil, 45, nil, nil, nil, 197, nil, + 107, nil, 198, 202, 200, 127, nil, nil, 126, nil, + nil, 132, nil, 133, 134, 226, 145, 147, 56, 57, + 58, 61, nil, nil, nil, 150, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, - 1, 90, :_reduce_1, - 1, 90, :_reduce_2, - 1, 90, :_reduce_none, - 1, 91, :_reduce_4, - 1, 94, :_reduce_5, - 3, 94, :_reduce_6, - 2, 94, :_reduce_7, - 1, 95, :_reduce_8, - 3, 95, :_reduce_9, - 1, 96, :_reduce_none, - 1, 97, :_reduce_11, - 3, 97, :_reduce_12, - 3, 97, :_reduce_13, - 3, 97, :_reduce_14, - 3, 97, :_reduce_15, - 1, 99, :_reduce_none, - 4, 99, :_reduce_17, - 3, 99, :_reduce_18, - 3, 99, :_reduce_19, - 3, 99, :_reduce_20, - 3, 99, :_reduce_21, - 3, 99, :_reduce_22, - 3, 99, :_reduce_23, - 3, 99, :_reduce_24, - 3, 99, :_reduce_25, - 3, 99, :_reduce_26, - 3, 99, :_reduce_27, - 2, 99, :_reduce_28, - 3, 99, :_reduce_29, - 3, 99, :_reduce_30, - 3, 99, :_reduce_31, - 3, 99, :_reduce_32, - 3, 99, :_reduce_33, - 3, 99, :_reduce_34, - 2, 99, :_reduce_35, - 3, 99, :_reduce_36, - 3, 99, :_reduce_37, - 3, 99, :_reduce_38, - 3, 99, :_reduce_39, - 3, 99, :_reduce_40, - 3, 99, :_reduce_41, - 3, 99, :_reduce_42, - 1, 101, :_reduce_43, - 3, 101, :_reduce_44, + 1, 91, :_reduce_1, + 1, 91, :_reduce_2, + 1, 91, :_reduce_none, + 1, 92, :_reduce_4, + 1, 95, :_reduce_5, + 3, 95, :_reduce_6, + 2, 95, :_reduce_7, + 1, 96, :_reduce_8, + 3, 96, :_reduce_9, + 1, 97, :_reduce_none, + 1, 98, :_reduce_11, + 3, 98, :_reduce_12, + 3, 98, :_reduce_13, + 3, 98, :_reduce_14, + 3, 98, :_reduce_15, 1, 100, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, - 1, 104, :_reduce_none, + 4, 100, :_reduce_17, + 3, 100, :_reduce_18, + 3, 100, :_reduce_19, + 3, 100, :_reduce_20, + 3, 100, :_reduce_21, + 3, 100, :_reduce_22, + 3, 100, :_reduce_23, + 3, 100, :_reduce_24, + 3, 100, :_reduce_25, + 3, 100, :_reduce_26, + 3, 100, :_reduce_27, + 2, 100, :_reduce_28, + 3, 100, :_reduce_29, + 3, 100, :_reduce_30, + 3, 100, :_reduce_31, + 3, 100, :_reduce_32, + 3, 100, :_reduce_33, + 3, 100, :_reduce_34, + 2, 100, :_reduce_35, + 3, 100, :_reduce_36, + 3, 100, :_reduce_37, + 3, 100, :_reduce_38, + 3, 100, :_reduce_39, + 3, 100, :_reduce_40, + 3, 100, :_reduce_41, + 3, 100, :_reduce_42, + 1, 102, :_reduce_43, + 3, 102, :_reduce_44, + 1, 101, :_reduce_none, + 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, 1, 105, :_reduce_none, - 1, 122, :_reduce_67, - 1, 122, :_reduce_68, - 5, 103, :_reduce_69, - 3, 103, :_reduce_70, - 6, 103, :_reduce_71, - 4, 103, :_reduce_72, - 1, 103, :_reduce_73, - 1, 107, :_reduce_74, - 2, 107, :_reduce_75, - 4, 130, :_reduce_76, - 3, 130, :_reduce_77, - 1, 130, :_reduce_78, - 3, 131, :_reduce_79, - 2, 129, :_reduce_80, - 3, 133, :_reduce_81, - 2, 133, :_reduce_82, - 2, 132, :_reduce_83, - 4, 132, :_reduce_84, - 2, 110, :_reduce_85, - 5, 135, :_reduce_86, - 4, 135, :_reduce_87, - 0, 136, :_reduce_none, - 2, 136, :_reduce_89, - 4, 136, :_reduce_90, - 3, 136, :_reduce_91, - 6, 111, :_reduce_92, - 5, 111, :_reduce_93, + 1, 105, :_reduce_none, + 1, 105, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 106, :_reduce_none, + 1, 123, :_reduce_67, + 1, 123, :_reduce_68, + 5, 104, :_reduce_69, + 3, 104, :_reduce_70, + 6, 104, :_reduce_71, + 4, 104, :_reduce_72, + 1, 104, :_reduce_73, + 1, 108, :_reduce_74, + 2, 108, :_reduce_75, + 4, 131, :_reduce_76, + 3, 131, :_reduce_77, + 1, 131, :_reduce_78, + 3, 132, :_reduce_79, + 2, 130, :_reduce_80, + 3, 134, :_reduce_81, + 2, 134, :_reduce_82, + 2, 133, :_reduce_83, + 4, 133, :_reduce_84, + 2, 111, :_reduce_85, + 5, 136, :_reduce_86, + 4, 136, :_reduce_87, 0, 137, :_reduce_none, - 4, 137, :_reduce_95, - 3, 137, :_reduce_96, - 5, 109, :_reduce_97, - 1, 138, :_reduce_98, - 2, 138, :_reduce_99, - 5, 139, :_reduce_100, - 4, 139, :_reduce_101, - 1, 140, :_reduce_102, - 1, 102, :_reduce_none, - 4, 102, :_reduce_104, - 1, 142, :_reduce_105, - 3, 142, :_reduce_106, - 3, 141, :_reduce_107, - 1, 98, :_reduce_108, - 6, 98, :_reduce_109, - 6, 98, :_reduce_110, - 5, 98, :_reduce_111, - 5, 98, :_reduce_112, - 6, 98, :_reduce_113, - 5, 98, :_reduce_114, - 4, 147, :_reduce_115, - 1, 148, :_reduce_116, - 1, 144, :_reduce_117, - 3, 144, :_reduce_118, - 1, 143, :_reduce_119, - 2, 143, :_reduce_120, - 1, 143, :_reduce_121, - 6, 108, :_reduce_122, - 2, 108, :_reduce_123, - 3, 149, :_reduce_124, - 3, 149, :_reduce_125, - 1, 150, :_reduce_none, - 1, 150, :_reduce_none, - 0, 146, :_reduce_128, - 1, 146, :_reduce_129, - 3, 146, :_reduce_130, - 1, 152, :_reduce_none, - 1, 152, :_reduce_none, - 1, 152, :_reduce_none, - 3, 151, :_reduce_134, - 3, 151, :_reduce_135, - 6, 112, :_reduce_136, - 7, 113, :_reduce_137, - 1, 157, :_reduce_138, - 1, 156, :_reduce_none, - 1, 156, :_reduce_none, - 1, 158, :_reduce_none, - 2, 158, :_reduce_142, - 1, 159, :_reduce_none, + 2, 137, :_reduce_89, + 4, 137, :_reduce_90, + 3, 137, :_reduce_91, + 6, 112, :_reduce_92, + 5, 112, :_reduce_93, + 0, 138, :_reduce_none, + 4, 138, :_reduce_95, + 3, 138, :_reduce_96, + 5, 110, :_reduce_97, + 1, 139, :_reduce_98, + 2, 139, :_reduce_99, + 5, 140, :_reduce_100, + 4, 140, :_reduce_101, + 1, 141, :_reduce_102, + 1, 103, :_reduce_none, + 4, 103, :_reduce_104, + 1, 143, :_reduce_105, + 3, 143, :_reduce_106, + 3, 142, :_reduce_107, + 1, 99, :_reduce_108, + 6, 99, :_reduce_109, + 6, 99, :_reduce_110, + 5, 99, :_reduce_111, + 5, 99, :_reduce_112, + 6, 99, :_reduce_113, + 5, 99, :_reduce_114, + 4, 148, :_reduce_115, + 1, 149, :_reduce_116, + 1, 145, :_reduce_117, + 3, 145, :_reduce_118, + 1, 144, :_reduce_119, + 2, 144, :_reduce_120, + 1, 144, :_reduce_121, + 6, 109, :_reduce_122, + 2, 109, :_reduce_123, + 3, 150, :_reduce_124, + 3, 150, :_reduce_125, + 1, 151, :_reduce_none, + 1, 151, :_reduce_none, + 0, 147, :_reduce_128, + 1, 147, :_reduce_129, + 3, 147, :_reduce_130, + 1, 153, :_reduce_none, + 1, 153, :_reduce_none, + 1, 153, :_reduce_none, + 3, 152, :_reduce_134, + 3, 152, :_reduce_135, + 6, 113, :_reduce_136, + 7, 114, :_reduce_137, + 1, 158, :_reduce_138, + 1, 157, :_reduce_none, + 1, 157, :_reduce_none, 1, 159, :_reduce_none, - 6, 114, :_reduce_145, - 5, 114, :_reduce_146, - 1, 160, :_reduce_147, - 3, 160, :_reduce_148, - 1, 162, :_reduce_149, - 1, 162, :_reduce_150, - 1, 162, :_reduce_151, + 2, 159, :_reduce_142, + 1, 160, :_reduce_none, + 1, 160, :_reduce_none, + 6, 115, :_reduce_145, + 5, 115, :_reduce_146, + 1, 161, :_reduce_147, + 3, 161, :_reduce_148, + 1, 163, :_reduce_149, + 1, 163, :_reduce_150, + 1, 163, :_reduce_151, + 1, 163, :_reduce_none, + 1, 164, :_reduce_153, + 3, 164, :_reduce_154, 1, 162, :_reduce_none, - 1, 163, :_reduce_153, - 3, 163, :_reduce_154, - 1, 161, :_reduce_none, - 2, 161, :_reduce_156, - 1, 116, :_reduce_157, - 1, 154, :_reduce_158, - 1, 154, :_reduce_159, - 1, 155, :_reduce_160, - 2, 155, :_reduce_161, - 4, 155, :_reduce_162, - 1, 134, :_reduce_163, - 3, 134, :_reduce_164, - 3, 164, :_reduce_165, - 1, 164, :_reduce_166, - 1, 106, :_reduce_167, - 3, 117, :_reduce_168, - 4, 117, :_reduce_169, - 2, 117, :_reduce_170, - 3, 117, :_reduce_171, - 4, 117, :_reduce_172, - 2, 117, :_reduce_173, - 3, 120, :_reduce_174, - 4, 120, :_reduce_175, - 2, 120, :_reduce_176, - 1, 165, :_reduce_177, - 3, 165, :_reduce_178, - 3, 166, :_reduce_179, - 1, 127, :_reduce_none, - 1, 127, :_reduce_none, - 1, 127, :_reduce_none, - 1, 167, :_reduce_183, - 2, 168, :_reduce_184, - 1, 170, :_reduce_185, - 1, 172, :_reduce_186, + 2, 162, :_reduce_156, + 1, 117, :_reduce_157, + 1, 155, :_reduce_158, + 1, 155, :_reduce_159, + 1, 156, :_reduce_160, + 2, 156, :_reduce_161, + 4, 156, :_reduce_162, + 1, 135, :_reduce_163, + 3, 135, :_reduce_164, + 3, 165, :_reduce_165, + 1, 165, :_reduce_166, + 1, 107, :_reduce_167, + 3, 118, :_reduce_168, + 4, 118, :_reduce_169, + 2, 118, :_reduce_170, + 3, 118, :_reduce_171, + 4, 118, :_reduce_172, + 2, 118, :_reduce_173, + 3, 121, :_reduce_174, + 4, 121, :_reduce_175, + 2, 121, :_reduce_176, + 1, 166, :_reduce_177, + 3, 166, :_reduce_178, + 3, 167, :_reduce_179, + 1, 128, :_reduce_none, + 1, 128, :_reduce_none, + 1, 128, :_reduce_none, + 1, 168, :_reduce_183, + 1, 168, :_reduce_184, + 2, 169, :_reduce_185, + 1, 171, :_reduce_186, 1, 173, :_reduce_187, - 2, 171, :_reduce_188, - 1, 174, :_reduce_189, + 1, 174, :_reduce_188, + 2, 172, :_reduce_189, 1, 175, :_reduce_190, - 2, 175, :_reduce_191, - 2, 169, :_reduce_192, - 2, 176, :_reduce_193, - 2, 176, :_reduce_194, - 3, 92, :_reduce_195, - 0, 177, :_reduce_196, - 2, 177, :_reduce_197, - 4, 177, :_reduce_198, - 1, 115, :_reduce_199, - 3, 115, :_reduce_200, - 5, 115, :_reduce_201, - 1, 178, :_reduce_none, - 1, 178, :_reduce_none, - 1, 123, :_reduce_204, - 1, 126, :_reduce_205, - 1, 124, :_reduce_206, + 1, 176, :_reduce_191, + 2, 176, :_reduce_192, + 2, 170, :_reduce_193, + 2, 177, :_reduce_194, + 2, 177, :_reduce_195, + 3, 93, :_reduce_196, + 0, 178, :_reduce_197, + 2, 178, :_reduce_198, + 4, 178, :_reduce_199, + 1, 116, :_reduce_200, + 3, 116, :_reduce_201, + 5, 116, :_reduce_202, + 1, 179, :_reduce_none, + 1, 179, :_reduce_none, + 1, 124, :_reduce_205, + 1, 127, :_reduce_206, 1, 125, :_reduce_207, - 1, 119, :_reduce_208, - 1, 118, :_reduce_209, - 1, 121, :_reduce_210, - 0, 128, :_reduce_none, - 1, 128, :_reduce_212, - 0, 145, :_reduce_none, - 1, 145, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 1, 153, :_reduce_none, - 0, 93, :_reduce_229 ] - -racc_reduce_n = 230 - -racc_shift_n = 402 + 1, 126, :_reduce_208, + 1, 120, :_reduce_209, + 1, 119, :_reduce_210, + 1, 122, :_reduce_211, + 0, 129, :_reduce_none, + 1, 129, :_reduce_213, + 0, 146, :_reduce_none, + 1, 146, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 1, 154, :_reduce_none, + 0, 94, :_reduce_230 ] + +racc_reduce_n = 231 + +racc_shift_n = 403 racc_token_table = { false => 0, :error => 1, :STRING => 2, :DQPRE => 3, :DQMID => 4, :DQPOST => 5, - :LBRACK => 6, - :RBRACK => 7, - :LBRACE => 8, - :RBRACE => 9, - :SYMBOL => 10, - :FARROW => 11, - :COMMA => 12, - :TRUE => 13, - :FALSE => 14, - :EQUALS => 15, - :APPENDS => 16, - :DELETES => 17, - :LESSEQUAL => 18, - :NOTEQUAL => 19, - :DOT => 20, - :COLON => 21, - :LLCOLLECT => 22, - :RRCOLLECT => 23, - :QMARK => 24, - :LPAREN => 25, - :RPAREN => 26, - :ISEQUAL => 27, - :GREATEREQUAL => 28, - :GREATERTHAN => 29, - :LESSTHAN => 30, - :IF => 31, - :ELSE => 32, - :DEFINE => 33, - :ELSIF => 34, - :VARIABLE => 35, - :CLASS => 36, - :INHERITS => 37, - :NODE => 38, - :BOOLEAN => 39, - :NAME => 40, - :SEMIC => 41, - :CASE => 42, - :DEFAULT => 43, - :AT => 44, - :ATAT => 45, - :LCOLLECT => 46, - :RCOLLECT => 47, - :CLASSREF => 48, - :NOT => 49, - :OR => 50, - :AND => 51, - :UNDEF => 52, - :PARROW => 53, - :PLUS => 54, - :MINUS => 55, - :TIMES => 56, - :DIV => 57, - :LSHIFT => 58, - :RSHIFT => 59, - :UMINUS => 60, - :MATCH => 61, - :NOMATCH => 62, - :REGEX => 63, - :IN_EDGE => 64, - :OUT_EDGE => 65, - :IN_EDGE_SUB => 66, - :OUT_EDGE_SUB => 67, - :IN => 68, - :UNLESS => 69, - :PIPE => 70, - :LAMBDA => 71, - :SELBRACE => 72, - :NUMBER => 73, - :HEREDOC => 74, - :SUBLOCATE => 75, - :RENDER_STRING => 76, - :RENDER_EXPR => 77, - :EPP_START => 78, - :EPP_END => 79, - :EPP_END_TRIM => 80, - :FUNCTION => 81, - :LOW => 82, - :HIGH => 83, - :CALL => 84, - :LISTSTART => 85, - :MODULO => 86, - :TITLE_COLON => 87, - :CASE_COLON => 88 } - -racc_nt_base = 89 + :WORD => 6, + :LBRACK => 7, + :RBRACK => 8, + :LBRACE => 9, + :RBRACE => 10, + :SYMBOL => 11, + :FARROW => 12, + :COMMA => 13, + :TRUE => 14, + :FALSE => 15, + :EQUALS => 16, + :APPENDS => 17, + :DELETES => 18, + :LESSEQUAL => 19, + :NOTEQUAL => 20, + :DOT => 21, + :COLON => 22, + :LLCOLLECT => 23, + :RRCOLLECT => 24, + :QMARK => 25, + :LPAREN => 26, + :RPAREN => 27, + :ISEQUAL => 28, + :GREATEREQUAL => 29, + :GREATERTHAN => 30, + :LESSTHAN => 31, + :IF => 32, + :ELSE => 33, + :DEFINE => 34, + :ELSIF => 35, + :VARIABLE => 36, + :CLASS => 37, + :INHERITS => 38, + :NODE => 39, + :BOOLEAN => 40, + :NAME => 41, + :SEMIC => 42, + :CASE => 43, + :DEFAULT => 44, + :AT => 45, + :ATAT => 46, + :LCOLLECT => 47, + :RCOLLECT => 48, + :CLASSREF => 49, + :NOT => 50, + :OR => 51, + :AND => 52, + :UNDEF => 53, + :PARROW => 54, + :PLUS => 55, + :MINUS => 56, + :TIMES => 57, + :DIV => 58, + :LSHIFT => 59, + :RSHIFT => 60, + :UMINUS => 61, + :MATCH => 62, + :NOMATCH => 63, + :REGEX => 64, + :IN_EDGE => 65, + :OUT_EDGE => 66, + :IN_EDGE_SUB => 67, + :OUT_EDGE_SUB => 68, + :IN => 69, + :UNLESS => 70, + :PIPE => 71, + :LAMBDA => 72, + :SELBRACE => 73, + :NUMBER => 74, + :HEREDOC => 75, + :SUBLOCATE => 76, + :RENDER_STRING => 77, + :RENDER_EXPR => 78, + :EPP_START => 79, + :EPP_END => 80, + :EPP_END_TRIM => 81, + :FUNCTION => 82, + :LOW => 83, + :HIGH => 84, + :CALL => 85, + :LISTSTART => 86, + :MODULO => 87, + :TITLE_COLON => 88, + :CASE_COLON => 89 } + +racc_nt_base = 90 racc_use_result_var = true Racc_arg = [ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ] Racc_token_to_s_table = [ "$end", "error", "STRING", "DQPRE", "DQMID", "DQPOST", + "WORD", "LBRACK", "RBRACK", "LBRACE", "RBRACE", "SYMBOL", "FARROW", "COMMA", "TRUE", "FALSE", "EQUALS", "APPENDS", "DELETES", "LESSEQUAL", "NOTEQUAL", "DOT", "COLON", "LLCOLLECT", "RRCOLLECT", "QMARK", "LPAREN", "RPAREN", "ISEQUAL", "GREATEREQUAL", "GREATERTHAN", "LESSTHAN", "IF", "ELSE", "DEFINE", "ELSIF", "VARIABLE", "CLASS", "INHERITS", "NODE", "BOOLEAN", "NAME", "SEMIC", "CASE", "DEFAULT", "AT", "ATAT", "LCOLLECT", "RCOLLECT", "CLASSREF", "NOT", "OR", "AND", "UNDEF", "PARROW", "PLUS", "MINUS", "TIMES", "DIV", "LSHIFT", "RSHIFT", "UMINUS", "MATCH", "NOMATCH", "REGEX", "IN_EDGE", "OUT_EDGE", "IN_EDGE_SUB", "OUT_EDGE_SUB", "IN", "UNLESS", "PIPE", "LAMBDA", "SELBRACE", "NUMBER", "HEREDOC", "SUBLOCATE", "RENDER_STRING", "RENDER_EXPR", "EPP_START", "EPP_END", "EPP_END_TRIM", "FUNCTION", "LOW", "HIGH", "CALL", "LISTSTART", "MODULO", "TITLE_COLON", "CASE_COLON", "$start", "program", "statements", "epp_expression", "nil", "syntactic_statements", "syntactic_statement", "any_expression", "relationship_expression", "resource_expression", "expression", "higher_precedence", "expressions", "selector_entries", "call_function_expression", "primary_expression", "literal_expression", "variable", "call_method_with_lambda_expression", "collection_expression", "case_expression", "if_expression", "unless_expression", "definition_expression", "hostclass_expression", "node_definition_expression", "epp_render_expression", "function_definition", "array", "boolean", "default", "hash", "regex", "text_or_name", "number", "type", "undef", "name", "quotedtext", "endcomma", "lambda", "call_method_expression", "named_access", "lambda_parameter_list", "lambda_rest", "parameters", "if_part", "else", "unless_else", "case_options", "case_option", "case_colon", "selector_entry", "selector_entry_list", "at", "resourceinstances", "endsemi", "attribute_operations", "resourceinst", "title_colon", "collect_query", "optional_query", "attribute_operation", "attribute_name", "keyword", "classname", "parameter_list", "opt_statements", "stacked_classname", "classparent", "classnameordefault", "hostnames", "nodeparent", "hostname", "dotted_name", "parameter", "hashpairs", "hashpair", "string", "dq_string", "heredoc", "dqpre", "dqrval", "dqpost", "dqmid", "text_expression", "dqtail", "sublocated_text", "epp_parameters_list", "epp_end" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted -module_eval(<<'.,.,', 'egrammar.ra', 65) +module_eval(<<'.,.,', 'egrammar.ra', 66) def _reduce_1(val, _values, result) result = create_program(Factory.block_or_expression(*val[0])) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 66) +module_eval(<<'.,.,', 'egrammar.ra', 67) def _reduce_2(val, _values, result) result = create_program(Factory.block_or_expression(*val[0])) result end .,., # reduce 3 omitted -module_eval(<<'.,.,', 'egrammar.ra', 71) +module_eval(<<'.,.,', 'egrammar.ra', 72) def _reduce_4(val, _values, result) result = transform_calls(val[0]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 77) +module_eval(<<'.,.,', 'egrammar.ra', 78) def _reduce_5(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 78) +module_eval(<<'.,.,', 'egrammar.ra', 79) def _reduce_6(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 79) +module_eval(<<'.,.,', 'egrammar.ra', 80) def _reduce_7(val, _values, result) result = val[0].push val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 83) +module_eval(<<'.,.,', 'egrammar.ra', 84) def _reduce_8(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 84) +module_eval(<<'.,.,', 'egrammar.ra', 85) def _reduce_9(val, _values, result) result = aryfy(val[0]).push val[2] result end .,., # reduce 10 omitted -module_eval(<<'.,.,', 'egrammar.ra', 90) +module_eval(<<'.,.,', 'egrammar.ra', 91) def _reduce_11(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 91) +module_eval(<<'.,.,', 'egrammar.ra', 92) def _reduce_12(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 92) +module_eval(<<'.,.,', 'egrammar.ra', 93) def _reduce_13(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 93) +module_eval(<<'.,.,', 'egrammar.ra', 94) def _reduce_14(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 94) +module_eval(<<'.,.,', 'egrammar.ra', 95) def _reduce_15(val, _values, result) result = val[0].relop(val[1][:value], val[2]); loc result, val[1] result end .,., # reduce 16 omitted -module_eval(<<'.,.,', 'egrammar.ra', 101) +module_eval(<<'.,.,', 'egrammar.ra', 102) def _reduce_17(val, _values, result) result = val[0][*val[2]] ; loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 102) +module_eval(<<'.,.,', 'egrammar.ra', 103) def _reduce_18(val, _values, result) result = val[0].in val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 103) +module_eval(<<'.,.,', 'egrammar.ra', 104) def _reduce_19(val, _values, result) result = val[0] =~ val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 104) +module_eval(<<'.,.,', 'egrammar.ra', 105) def _reduce_20(val, _values, result) result = val[0].mne val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 105) +module_eval(<<'.,.,', 'egrammar.ra', 106) def _reduce_21(val, _values, result) result = val[0] + val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 106) +module_eval(<<'.,.,', 'egrammar.ra', 107) def _reduce_22(val, _values, result) result = val[0] - val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 107) +module_eval(<<'.,.,', 'egrammar.ra', 108) def _reduce_23(val, _values, result) result = val[0] / val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 108) +module_eval(<<'.,.,', 'egrammar.ra', 109) def _reduce_24(val, _values, result) result = val[0] * val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 109) +module_eval(<<'.,.,', 'egrammar.ra', 110) def _reduce_25(val, _values, result) result = val[0] % val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 110) +module_eval(<<'.,.,', 'egrammar.ra', 111) def _reduce_26(val, _values, result) result = val[0] << val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 111) +module_eval(<<'.,.,', 'egrammar.ra', 112) def _reduce_27(val, _values, result) result = val[0] >> val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 112) +module_eval(<<'.,.,', 'egrammar.ra', 113) def _reduce_28(val, _values, result) result = val[1].minus() ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 113) +module_eval(<<'.,.,', 'egrammar.ra', 114) def _reduce_29(val, _values, result) result = val[0].ne val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 114) +module_eval(<<'.,.,', 'egrammar.ra', 115) def _reduce_30(val, _values, result) result = val[0] == val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 115) +module_eval(<<'.,.,', 'egrammar.ra', 116) def _reduce_31(val, _values, result) result = val[0] > val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 116) +module_eval(<<'.,.,', 'egrammar.ra', 117) def _reduce_32(val, _values, result) result = val[0] >= val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 117) +module_eval(<<'.,.,', 'egrammar.ra', 118) def _reduce_33(val, _values, result) result = val[0] < val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 118) +module_eval(<<'.,.,', 'egrammar.ra', 119) def _reduce_34(val, _values, result) result = val[0] <= val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 119) +module_eval(<<'.,.,', 'egrammar.ra', 120) def _reduce_35(val, _values, result) result = val[1].not ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 120) +module_eval(<<'.,.,', 'egrammar.ra', 121) def _reduce_36(val, _values, result) result = val[0].and val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 121) +module_eval(<<'.,.,', 'egrammar.ra', 122) def _reduce_37(val, _values, result) result = val[0].or val[2] ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 122) +module_eval(<<'.,.,', 'egrammar.ra', 123) def _reduce_38(val, _values, result) result = val[0].set(val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 123) +module_eval(<<'.,.,', 'egrammar.ra', 124) def _reduce_39(val, _values, result) result = val[0].plus_set(val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 124) +module_eval(<<'.,.,', 'egrammar.ra', 125) def _reduce_40(val, _values, result) result = val[0].minus_set(val[2]); loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 125) +module_eval(<<'.,.,', 'egrammar.ra', 126) def _reduce_41(val, _values, result) result = val[0].select(*val[2]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 126) +module_eval(<<'.,.,', 'egrammar.ra', 127) def _reduce_42(val, _values, result) result = val[1].paren() ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 134) +module_eval(<<'.,.,', 'egrammar.ra', 135) def _reduce_43(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 135) +module_eval(<<'.,.,', 'egrammar.ra', 136) def _reduce_44(val, _values, result) result = val[0].push(val[2]) result end .,., # reduce 45 omitted # reduce 46 omitted # reduce 47 omitted # reduce 48 omitted # reduce 49 omitted # reduce 50 omitted # reduce 51 omitted # reduce 52 omitted # reduce 53 omitted # reduce 54 omitted # reduce 55 omitted # reduce 56 omitted # reduce 57 omitted # reduce 58 omitted # reduce 59 omitted # reduce 60 omitted # reduce 61 omitted # reduce 62 omitted # reduce 63 omitted # reduce 64 omitted # reduce 65 omitted # reduce 66 omitted -module_eval(<<'.,.,', 'egrammar.ra', 168) +module_eval(<<'.,.,', 'egrammar.ra', 169) def _reduce_67(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 169) +module_eval(<<'.,.,', 'egrammar.ra', 170) def _reduce_68(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 177) +module_eval(<<'.,.,', 'egrammar.ra', 178) def _reduce_69(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[2]) loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 181) +module_eval(<<'.,.,', 'egrammar.ra', 182) def _reduce_70(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 185) +module_eval(<<'.,.,', 'egrammar.ra', 186) def _reduce_71(val, _values, result) result = Factory.CALL_NAMED(val[0], true, val[2]) loc result, val[0], val[4] result.lambda = val[5] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 190) +module_eval(<<'.,.,', 'egrammar.ra', 191) def _reduce_72(val, _values, result) result = Factory.CALL_NAMED(val[0], true, []) loc result, val[0], val[2] result.lambda = val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 194) +module_eval(<<'.,.,', 'egrammar.ra', 195) def _reduce_73(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 199) +module_eval(<<'.,.,', 'egrammar.ra', 200) def _reduce_74(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 200) +module_eval(<<'.,.,', 'egrammar.ra', 201) def _reduce_75(val, _values, result) result = val[0]; val[0].lambda = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 203) +module_eval(<<'.,.,', 'egrammar.ra', 204) def _reduce_76(val, _values, result) result = Factory.CALL_METHOD(val[0], val[2]); loc result, val[1], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 204) +module_eval(<<'.,.,', 'egrammar.ra', 205) def _reduce_77(val, _values, result) result = Factory.CALL_METHOD(val[0], []); loc result, val[1], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 205) +module_eval(<<'.,.,', 'egrammar.ra', 206) def _reduce_78(val, _values, result) result = Factory.CALL_METHOD(val[0], []); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 210) +module_eval(<<'.,.,', 'egrammar.ra', 211) def _reduce_79(val, _values, result) result = val[0].dot(Factory.fqn(val[2][:value])) loc result, val[1], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 222) +module_eval(<<'.,.,', 'egrammar.ra', 223) def _reduce_80(val, _values, result) result = Factory.LAMBDA(val[0], val[1]) # loc result, val[1] # TODO result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 227) +module_eval(<<'.,.,', 'egrammar.ra', 228) def _reduce_81(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 228) +module_eval(<<'.,.,', 'egrammar.ra', 229) def _reduce_82(val, _values, result) result = nil result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 232) +module_eval(<<'.,.,', 'egrammar.ra', 233) def _reduce_83(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 233) +module_eval(<<'.,.,', 'egrammar.ra', 234) def _reduce_84(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 243) +module_eval(<<'.,.,', 'egrammar.ra', 244) def _reduce_85(val, _values, result) result = val[1] loc(result, val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 250) +module_eval(<<'.,.,', 'egrammar.ra', 251) def _reduce_86(val, _values, result) result = Factory.IF(val[0], Factory.block_or_expression(*val[2]), val[4]) loc(result, val[0], (val[4] ? val[4] : val[3])) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 254) +module_eval(<<'.,.,', 'egrammar.ra', 255) def _reduce_87(val, _values, result) result = Factory.IF(val[0], nil, val[3]) loc(result, val[0], (val[3] ? val[3] : val[2])) result end .,., # reduce 88 omitted -module_eval(<<'.,.,', 'egrammar.ra', 262) +module_eval(<<'.,.,', 'egrammar.ra', 263) def _reduce_89(val, _values, result) result = val[1] loc(result, val[0], val[1]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 266) +module_eval(<<'.,.,', 'egrammar.ra', 267) def _reduce_90(val, _values, result) result = Factory.block_or_expression(*val[2]) loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 270) +module_eval(<<'.,.,', 'egrammar.ra', 271) def _reduce_91(val, _values, result) result = nil # don't think a nop is needed here either result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 279) +module_eval(<<'.,.,', 'egrammar.ra', 280) def _reduce_92(val, _values, result) result = Factory.UNLESS(val[1], Factory.block_or_expression(*val[3]), val[5]) loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 283) +module_eval(<<'.,.,', 'egrammar.ra', 284) def _reduce_93(val, _values, result) result = Factory.UNLESS(val[1], nil, nil) loc result, val[0], val[4] result end .,., # reduce 94 omitted -module_eval(<<'.,.,', 'egrammar.ra', 293) +module_eval(<<'.,.,', 'egrammar.ra', 294) def _reduce_95(val, _values, result) result = Factory.block_or_expression(*val[2]) loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 297) +module_eval(<<'.,.,', 'egrammar.ra', 298) def _reduce_96(val, _values, result) result = nil # don't think a nop is needed here either result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 305) +module_eval(<<'.,.,', 'egrammar.ra', 306) def _reduce_97(val, _values, result) result = Factory.CASE(val[1], *val[3]) loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 311) +module_eval(<<'.,.,', 'egrammar.ra', 312) def _reduce_98(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 312) +module_eval(<<'.,.,', 'egrammar.ra', 313) def _reduce_99(val, _values, result) result = val[0].push val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 317) +module_eval(<<'.,.,', 'egrammar.ra', 318) def _reduce_100(val, _values, result) result = Factory.WHEN(val[0], val[3]) loc result, val[1], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 321) +module_eval(<<'.,.,', 'egrammar.ra', 322) def _reduce_101(val, _values, result) result = Factory.WHEN(val[0], nil) loc result, val[1], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 325) +module_eval(<<'.,.,', 'egrammar.ra', 326) def _reduce_102(val, _values, result) result = val[0] result end .,., # reduce 103 omitted -module_eval(<<'.,.,', 'egrammar.ra', 336) +module_eval(<<'.,.,', 'egrammar.ra', 337) def _reduce_104(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 341) +module_eval(<<'.,.,', 'egrammar.ra', 342) def _reduce_105(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 342) +module_eval(<<'.,.,', 'egrammar.ra', 343) def _reduce_106(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 347) +module_eval(<<'.,.,', 'egrammar.ra', 348) def _reduce_107(val, _values, result) result = Factory.MAP(val[0], val[2]) ; loc result, val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 359) +module_eval(<<'.,.,', 'egrammar.ra', 360) def _reduce_108(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 362) +module_eval(<<'.,.,', 'egrammar.ra', 363) def _reduce_109(val, _values, result) result = case Factory.resource_shape(val[1]) when :resource, :class tmp = Factory.RESOURCE(Factory.fqn(token_text(val[1])), val[3]) tmp.form = val[0] tmp when :defaults error val[1], "A resource default can not be virtual or exported" when :override error val[1], "A resource override can not be virtual or exported" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[1], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 377) +module_eval(<<'.,.,', 'egrammar.ra', 378) def _reduce_110(val, _values, result) result = case Factory.resource_shape(val[1]) when :resource, :class, :defaults, :override error val[1], "Defaults are not virtualizable" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 385) +module_eval(<<'.,.,', 'egrammar.ra', 386) def _reduce_111(val, _values, result) result = case Factory.resource_shape(val[0]) when :resource, :class Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) when :defaults error val[1], "A resource default can not specify a resource name" when :override error val[1], "A resource override does not allow override of name of resource" else error val[1], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 398) +module_eval(<<'.,.,', 'egrammar.ra', 399) def _reduce_112(val, _values, result) result = case Factory.resource_shape(val[0]) when :resource, :class # This catches deprecated syntax. # If the attribute operations does not include +>, then the found expression # is actually a LEFT followed by LITERAL_HASH # unless tmp = transform_resource_wo_title(val[0], val[2]) error val[1], "Syntax error resource body without title or hash with +>" end tmp when :defaults Factory.RESOURCE_DEFAULTS(val[0], val[2]) when :override # This was only done for override in original - TODO shuld it be here at all Factory.RESOURCE_OVERRIDE(val[0], val[2]) else error val[0], "Expression is not valid as a resource, resource-default, or resource-override" end loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 419) +module_eval(<<'.,.,', 'egrammar.ra', 420) def _reduce_113(val, _values, result) result = Factory.RESOURCE(Factory.fqn(token_text(val[1])), val[3]) result.form = val[0] loc result, val[1], val[5] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 424) +module_eval(<<'.,.,', 'egrammar.ra', 425) def _reduce_114(val, _values, result) result = Factory.RESOURCE(Factory.fqn(token_text(val[0])), val[2]) loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 429) +module_eval(<<'.,.,', 'egrammar.ra', 430) def _reduce_115(val, _values, result) result = Factory.RESOURCE_BODY(val[0], val[2]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 431) +module_eval(<<'.,.,', 'egrammar.ra', 432) def _reduce_116(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 434) +module_eval(<<'.,.,', 'egrammar.ra', 435) def _reduce_117(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 435) +module_eval(<<'.,.,', 'egrammar.ra', 436) def _reduce_118(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 440) +module_eval(<<'.,.,', 'egrammar.ra', 441) def _reduce_119(val, _values, result) result = :virtual result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 441) +module_eval(<<'.,.,', 'egrammar.ra', 442) def _reduce_120(val, _values, result) result = :exported result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 442) +module_eval(<<'.,.,', 'egrammar.ra', 443) def _reduce_121(val, _values, result) result = :exported result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 454) +module_eval(<<'.,.,', 'egrammar.ra', 455) def _reduce_122(val, _values, result) result = Factory.COLLECT(val[0], val[1], val[3]) loc result, val[0], val[5] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 458) +module_eval(<<'.,.,', 'egrammar.ra', 459) def _reduce_123(val, _values, result) result = Factory.COLLECT(val[0], val[1], []) loc result, val[0], val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 463) +module_eval(<<'.,.,', 'egrammar.ra', 464) def _reduce_124(val, _values, result) result = Factory.VIRTUAL_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 464) +module_eval(<<'.,.,', 'egrammar.ra', 465) def _reduce_125(val, _values, result) result = Factory.EXPORTED_QUERY(val[1]) ; loc result, val[0], val[2] result end .,., # reduce 126 omitted # reduce 127 omitted -module_eval(<<'.,.,', 'egrammar.ra', 477) +module_eval(<<'.,.,', 'egrammar.ra', 478) def _reduce_128(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 478) +module_eval(<<'.,.,', 'egrammar.ra', 479) def _reduce_129(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 479) +module_eval(<<'.,.,', 'egrammar.ra', 480) def _reduce_130(val, _values, result) result = val[0].push(val[2]) result end .,., # reduce 131 omitted # reduce 132 omitted # reduce 133 omitted -module_eval(<<'.,.,', 'egrammar.ra', 495) +module_eval(<<'.,.,', 'egrammar.ra', 496) def _reduce_134(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], :'=>', val[2]) loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 499) +module_eval(<<'.,.,', 'egrammar.ra', 500) def _reduce_135(val, _values, result) result = Factory.ATTRIBUTE_OP(val[0][:value], :'+>', val[2]) loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 509) +module_eval(<<'.,.,', 'egrammar.ra', 510) def _reduce_136(val, _values, result) result = add_definition(Factory.DEFINITION(classname(val[1][:value]), val[2], val[4])) loc result, val[0], val[5] # New lexer does not keep track of this, this is done in validation if @lexer.respond_to?(:'indefine=') @lexer.indefine = false end result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 523) +module_eval(<<'.,.,', 'egrammar.ra', 524) def _reduce_137(val, _values, result) # Remove this class' name from the namestack as all nested classes have been parsed namepop result = add_definition(Factory.HOSTCLASS(classname(val[1][:value]), val[2], token_text(val[3]), val[5])) loc result, val[0], val[6] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 533) +module_eval(<<'.,.,', 'egrammar.ra', 534) def _reduce_138(val, _values, result) namestack(val[0][:value]) ; result = val[0] result end .,., # reduce 139 omitted # reduce 140 omitted # reduce 141 omitted -module_eval(<<'.,.,', 'egrammar.ra', 542) +module_eval(<<'.,.,', 'egrammar.ra', 543) def _reduce_142(val, _values, result) result = val[1] result end .,., # reduce 143 omitted # reduce 144 omitted -module_eval(<<'.,.,', 'egrammar.ra', 559) +module_eval(<<'.,.,', 'egrammar.ra', 560) def _reduce_145(val, _values, result) result = add_definition(Factory.NODE(val[1], val[2], val[4])) loc result, val[0], val[5] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 563) +module_eval(<<'.,.,', 'egrammar.ra', 564) def _reduce_146(val, _values, result) result = add_definition(Factory.NODE(val[1], val[2], nil)) loc result, val[0], val[4] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 573) +module_eval(<<'.,.,', 'egrammar.ra', 574) def _reduce_147(val, _values, result) result = [result] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 574) +module_eval(<<'.,.,', 'egrammar.ra', 575) def _reduce_148(val, _values, result) result = val[0].push(val[2]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 579) +module_eval(<<'.,.,', 'egrammar.ra', 580) def _reduce_149(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 580) +module_eval(<<'.,.,', 'egrammar.ra', 581) def _reduce_150(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 581) +module_eval(<<'.,.,', 'egrammar.ra', 582) def _reduce_151(val, _values, result) result = Factory.literal(:default); loc result, val[0] result end .,., # reduce 152 omitted -module_eval(<<'.,.,', 'egrammar.ra', 585) +module_eval(<<'.,.,', 'egrammar.ra', 586) def _reduce_153(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 586) +module_eval(<<'.,.,', 'egrammar.ra', 587) def _reduce_154(val, _values, result) result = Factory.concat(val[0], '.', val[2][:value]); loc result, val[0], val[2] result end .,., # reduce 155 omitted -module_eval(<<'.,.,', 'egrammar.ra', 591) +module_eval(<<'.,.,', 'egrammar.ra', 592) def _reduce_156(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 596) +module_eval(<<'.,.,', 'egrammar.ra', 597) def _reduce_157(val, _values, result) result = Factory.QNAME(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 608) +module_eval(<<'.,.,', 'egrammar.ra', 609) def _reduce_158(val, _values, result) result = val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 609) +module_eval(<<'.,.,', 'egrammar.ra', 610) def _reduce_159(val, _values, result) error val[0], "'class' is not a valid classname" result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 613) +module_eval(<<'.,.,', 'egrammar.ra', 614) def _reduce_160(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 614) +module_eval(<<'.,.,', 'egrammar.ra', 615) def _reduce_161(val, _values, result) result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 615) +module_eval(<<'.,.,', 'egrammar.ra', 616) def _reduce_162(val, _values, result) result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 619) +module_eval(<<'.,.,', 'egrammar.ra', 620) def _reduce_163(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 620) +module_eval(<<'.,.,', 'egrammar.ra', 621) def _reduce_164(val, _values, result) result = val[0].push(val[2]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 624) +module_eval(<<'.,.,', 'egrammar.ra', 625) def _reduce_165(val, _values, result) result = Factory.PARAM(val[0][:value], val[2]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 625) +module_eval(<<'.,.,', 'egrammar.ra', 626) def _reduce_166(val, _values, result) result = Factory.PARAM(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 638) +module_eval(<<'.,.,', 'egrammar.ra', 639) def _reduce_167(val, _values, result) result = Factory.fqn(val[0][:value]).var ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 644) +module_eval(<<'.,.,', 'egrammar.ra', 645) def _reduce_168(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 645) +module_eval(<<'.,.,', 'egrammar.ra', 646) def _reduce_169(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 646) +module_eval(<<'.,.,', 'egrammar.ra', 647) def _reduce_170(val, _values, result) result = Factory.literal([]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 647) +module_eval(<<'.,.,', 'egrammar.ra', 648) def _reduce_171(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 648) +module_eval(<<'.,.,', 'egrammar.ra', 649) def _reduce_172(val, _values, result) result = Factory.LIST(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 649) +module_eval(<<'.,.,', 'egrammar.ra', 650) def _reduce_173(val, _values, result) result = Factory.literal([]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 652) +module_eval(<<'.,.,', 'egrammar.ra', 653) def _reduce_174(val, _values, result) result = Factory.HASH(val[1]); loc result, val[0], val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 653) +module_eval(<<'.,.,', 'egrammar.ra', 654) def _reduce_175(val, _values, result) result = Factory.HASH(val[1]); loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 654) +module_eval(<<'.,.,', 'egrammar.ra', 655) def _reduce_176(val, _values, result) result = Factory.literal({}) ; loc result, val[0], val[3] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 657) +module_eval(<<'.,.,', 'egrammar.ra', 658) def _reduce_177(val, _values, result) result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 658) +module_eval(<<'.,.,', 'egrammar.ra', 659) def _reduce_178(val, _values, result) result = val[0].push val[2] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 661) +module_eval(<<'.,.,', 'egrammar.ra', 662) def _reduce_179(val, _values, result) result = Factory.KEY_ENTRY(val[0], val[2]); loc result, val[1] result end .,., # reduce 180 omitted # reduce 181 omitted # reduce 182 omitted -module_eval(<<'.,.,', 'egrammar.ra', 668) +module_eval(<<'.,.,', 'egrammar.ra', 670) def _reduce_183(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 669) +module_eval(<<'.,.,', 'egrammar.ra', 671) def _reduce_184(val, _values, result) - result = Factory.string(val[0], *val[1]) ; loc result, val[0], val[1][-1] + result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 670) +module_eval(<<'.,.,', 'egrammar.ra', 673) def _reduce_185(val, _values, result) - result = Factory.literal(val[0][:value]); loc result, val[0] + result = Factory.string(val[0], *val[1]) ; loc result, val[0], val[1][-1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 671) +module_eval(<<'.,.,', 'egrammar.ra', 674) def _reduce_186(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 672) +module_eval(<<'.,.,', 'egrammar.ra', 675) def _reduce_187(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 673) +module_eval(<<'.,.,', 'egrammar.ra', 676) def _reduce_188(val, _values, result) - result = [val[0]] + val[1] + result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 674) +module_eval(<<'.,.,', 'egrammar.ra', 677) def _reduce_189(val, _values, result) - result = Factory.TEXT(val[0]) + result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 677) +module_eval(<<'.,.,', 'egrammar.ra', 678) def _reduce_190(val, _values, result) - result = [val[0]] + result = Factory.TEXT(val[0]) result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 678) +module_eval(<<'.,.,', 'egrammar.ra', 681) def _reduce_191(val, _values, result) - result = [val[0]] + val[1] + result = [val[0]] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 681) +module_eval(<<'.,.,', 'egrammar.ra', 682) def _reduce_192(val, _values, result) - result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] + result = [val[0]] + val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 684) +module_eval(<<'.,.,', 'egrammar.ra', 685) def _reduce_193(val, _values, result) - result = Factory.SUBLOCATE(val[0], val[1]); loc result, val[0] + result = Factory.HEREDOC(val[0][:value], val[1]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 685) +module_eval(<<'.,.,', 'egrammar.ra', 688) def _reduce_194(val, _values, result) result = Factory.SUBLOCATE(val[0], val[1]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 688) +module_eval(<<'.,.,', 'egrammar.ra', 689) def _reduce_195(val, _values, result) - result = Factory.EPP(val[1], val[2]); loc result, val[0] + result = Factory.SUBLOCATE(val[0], val[1]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 691) +module_eval(<<'.,.,', 'egrammar.ra', 692) def _reduce_196(val, _values, result) - result = nil + result = Factory.EPP(val[1], val[2]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 692) +module_eval(<<'.,.,', 'egrammar.ra', 695) def _reduce_197(val, _values, result) - result = [] + result = nil result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 693) +module_eval(<<'.,.,', 'egrammar.ra', 696) def _reduce_198(val, _values, result) - result = val[1] + result = [] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 696) +module_eval(<<'.,.,', 'egrammar.ra', 697) def _reduce_199(val, _values, result) - result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] + result = val[1] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 697) +module_eval(<<'.,.,', 'egrammar.ra', 700) def _reduce_200(val, _values, result) - result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] + result = Factory.RENDER_STRING(val[0][:value]); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 698) +module_eval(<<'.,.,', 'egrammar.ra', 701) def _reduce_201(val, _values, result) - result = Factory.RENDER_EXPR(Factory.block_or_expression(*val[2])); loc result, val[0], val[4] + result = Factory.RENDER_EXPR(val[1]); loc result, val[0], val[2] result end .,., -# reduce 202 omitted +module_eval(<<'.,.,', 'egrammar.ra', 702) + def _reduce_202(val, _values, result) + result = Factory.RENDER_EXPR(Factory.block_or_expression(*val[2])); loc result, val[0], val[4] + result + end +.,., # reduce 203 omitted -module_eval(<<'.,.,', 'egrammar.ra', 704) - def _reduce_204(val, _values, result) +# reduce 204 omitted + +module_eval(<<'.,.,', 'egrammar.ra', 708) + def _reduce_205(val, _values, result) result = Factory.NUMBER(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 705) - def _reduce_205(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 709) + def _reduce_206(val, _values, result) result = Factory.QNAME_OR_NUMBER(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 706) - def _reduce_206(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 710) + def _reduce_207(val, _values, result) result = Factory.QREF(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 707) - def _reduce_207(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 711) + def _reduce_208(val, _values, result) result = Factory.literal(:undef); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 708) - def _reduce_208(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 712) + def _reduce_209(val, _values, result) result = Factory.literal(:default); loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 713) - def _reduce_209(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 717) + def _reduce_210(val, _values, result) result = Factory.literal(val[0][:value]) ; loc result, val[0] result end .,., -module_eval(<<'.,.,', 'egrammar.ra', 716) - def _reduce_210(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 720) + def _reduce_211(val, _values, result) result = Factory.literal(val[0][:value]); loc result, val[0] result end .,., -# reduce 211 omitted +# reduce 212 omitted -module_eval(<<'.,.,', 'egrammar.ra', 722) - def _reduce_212(val, _values, result) +module_eval(<<'.,.,', 'egrammar.ra', 726) + def _reduce_213(val, _values, result) result = nil result end .,., -# reduce 213 omitted - # reduce 214 omitted # reduce 215 omitted # reduce 216 omitted # reduce 217 omitted # reduce 218 omitted # reduce 219 omitted # reduce 220 omitted # reduce 221 omitted # reduce 222 omitted # reduce 223 omitted # reduce 224 omitted # reduce 225 omitted # reduce 226 omitted # reduce 227 omitted # reduce 228 omitted -module_eval(<<'.,.,', 'egrammar.ra', 745) - def _reduce_229(val, _values, result) +# reduce 229 omitted + +module_eval(<<'.,.,', 'egrammar.ra', 749) + def _reduce_230(val, _values, result) result = nil result end .,., def _reduce_none(val, _values, result) val[0] end end # class Parser end # module Parser end # module Pops end # module Puppet diff --git a/lib/puppet/pops/parser/interpolation_support.rb b/lib/puppet/pops/parser/interpolation_support.rb index f6a40da3c..1852fcbc3 100644 --- a/lib/puppet/pops/parser/interpolation_support.rb +++ b/lib/puppet/pops/parser/interpolation_support.rb @@ -1,231 +1,231 @@ # This module is an integral part of the Lexer. # It defines interpolation support # PERFORMANCE NOTE: There are 4 very similar methods in this module that are designed to be as # performant as possible. While it is possible to parameterize them into one common method, the overhead # of passing parameters and evaluating conditional logic has a negative impact on performance. # module Puppet::Pops::Parser::InterpolationSupport PATTERN_VARIABLE = %r{(::)?(\w+::)*\w+} # This is the starting point for a double quoted string with possible interpolation # The structure mimics that of the grammar. # The logic is explicit (where the former implementation used parameters/strucures) given to a # generic handler. # (This is both easier to understand and faster). # def interpolate_dq scn = @scanner ctx = @lexing_context before = scn.pos # skip the leading " by doing a scan since the slurp_dqstring uses last matched when there is an error scn.scan(/"/) value,terminator = slurp_dqstring() text = value after = scn.pos while true case terminator when '"' # simple case, there was no interpolation, return directly return emit_completed([:STRING, text, scn.pos-before], before) when '${' count = ctx[:brace_count] ctx[:brace_count] += 1 # The ${ terminator is counted towards the string part enqueue_completed([:DQPRE, text, scn.pos-before], before) # Lex expression tokens until a closing (balanced) brace count is reached enqueue_until count break when '$' if varname = scn.scan(PATTERN_VARIABLE) # The $ is counted towards the variable enqueue_completed([:DQPRE, text, after-before-1], before) enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after -1) break else # false $ variable start text += terminator value,terminator = slurp_dqstring() text += value after = scn.pos end end end interpolate_tail_dq # return the first enqueued token and shift the queue @token_queue.shift end def interpolate_tail_dq scn = @scanner ctx = @lexing_context before = scn.pos value,terminator = slurp_dqstring text = value after = scn.pos while true case terminator when '"' # simple case, there was no further interpolation, return directly enqueue_completed([:DQPOST, text, scn.pos-before], before) return when '${' count = ctx[:brace_count] ctx[:brace_count] += 1 # The ${ terminator is counted towards the string part enqueue_completed([:DQMID, text, scn.pos-before], before) # Lex expression tokens until a closing (balanced) brace count is reached enqueue_until count break when '$' if varname = scn.scan(PATTERN_VARIABLE) # The $ is counted towards the variable enqueue_completed([:DQMID, text, after-before-1], before) enqueue_completed([:VARIABLE, varname, scn.pos - after +1], after -1) break else # false $ variable start text += terminator value,terminator = slurp_dqstring text += value after = scn.pos end end end interpolate_tail_dq end # This is the starting point for a un-quoted string with possible interpolation # The logic is explicit (where the former implementation used parameters/strucures) given to a # generic handler. # (This is both easier to understand and faster). # def interpolate_uq scn = @scanner ctx = @lexing_context before = scn.pos value,terminator = slurp_uqstring() text = value after = scn.pos while true case terminator when '' # simple case, there was no interpolation, return directly enqueue_completed([:STRING, text, scn.pos-before], before) return when '${' count = ctx[:brace_count] ctx[:brace_count] += 1 # The ${ terminator is counted towards the string part enqueue_completed([:DQPRE, text, scn.pos-before], before) # Lex expression tokens until a closing (balanced) brace count is reached enqueue_until count break when '$' if varname = scn.scan(PATTERN_VARIABLE) # The $ is counted towards the variable enqueue_completed([:DQPRE, text, after-before-1], before) enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after -1) break else # false $ variable start text += terminator value,terminator = slurp_uqstring() text += value after = scn.pos end end end interpolate_tail_uq nil end def interpolate_tail_uq scn = @scanner ctx = @lexing_context before = scn.pos value,terminator = slurp_uqstring text = value after = scn.pos while true case terminator when '' # simple case, there was no further interpolation, return directly enqueue_completed([:DQPOST, text, scn.pos-before], before) return when '${' count = ctx[:brace_count] ctx[:brace_count] += 1 # The ${ terminator is counted towards the string part enqueue_completed([:DQMID, text, scn.pos-before], before) # Lex expression tokens until a closing (balanced) brace count is reached enqueue_until count break when '$' if varname = scn.scan(PATTERN_VARIABLE) # The $ is counted towards the variable enqueue_completed([:DQMID, text, after-before-1], before) enqueue_completed([:VARIABLE, varname, scn.pos - after +1], after -1) break else # false $ variable start text += terminator value,terminator = slurp_uqstring text += value after = scn.pos end end end interpolate_tail_uq end # Enqueues lexed tokens until either end of input, or the given brace_count is reached # def enqueue_until brace_count scn = @scanner ctx = @lexing_context queue = @token_queue scn.skip(self.class::PATTERN_WS) queue_size = queue.size until scn.eos? do if token = lex_token token_name = token[0] ctx[:after] = token_name if token_name == :RBRACE && ctx[:brace_count] == brace_count if queue.size - queue_size == 1 # Single token is subject to replacement queue[-1] = transform_to_variable(queue[-1]) end return end queue << token else scn.skip(self.class::PATTERN_WS) end end end def transform_to_variable(token) token_name = token[0] - if [:NUMBER, :NAME].include?(token_name) || self.class::KEYWORD_NAMES[token_name] + if [:NUMBER, :NAME, :WORD].include?(token_name) || self.class::KEYWORD_NAMES[token_name] t = token[1] ta = t.token_array [:VARIABLE, self.class::TokenValue.new([:VARIABLE, ta[1], ta[2]], t.offset, t.locator)] else token end end # Interpolates unquoted string and transfers the result to the given lexer # (This is used when a second lexer instance is used to lex a substring) # def interpolate_uq_to(lexer) interpolate_uq queue = @token_queue until queue.empty? do lexer.enqueue(queue.shift) end end end diff --git a/lib/puppet/pops/parser/lexer2.rb b/lib/puppet/pops/parser/lexer2.rb index bef7902a4..aee0f6678 100644 --- a/lib/puppet/pops/parser/lexer2.rb +++ b/lib/puppet/pops/parser/lexer2.rb @@ -1,685 +1,692 @@ # The Lexer is responsbile for turning source text into tokens. # This version is a performance enhanced lexer (in comparison to the 3.x and earlier "future parser" lexer. # # Old returns tokens [:KEY, value, { locator = } # Could return [[token], locator] # or Token.new([token], locator) with the same API x[0] = token_symbol, x[1] = self, x[:key] = (:value, :file, :line, :pos) etc require 'strscan' require 'puppet/pops/parser/lexer_support' require 'puppet/pops/parser/heredoc_support' require 'puppet/pops/parser/interpolation_support' require 'puppet/pops/parser/epp_support' require 'puppet/pops/parser/slurp_support' class Puppet::Pops::Parser::Lexer2 include Puppet::Pops::Parser::LexerSupport include Puppet::Pops::Parser::HeredocSupport include Puppet::Pops::Parser::InterpolationSupport include Puppet::Pops::Parser::SlurpSupport include Puppet::Pops::Parser::EppSupport # ALl tokens have three slots, the token name (a Symbol), the token text (String), and a token text length. # All operator and punctuation tokens reuse singleton arrays Tokens that require unique values create # a unique array per token. # # PEFORMANCE NOTES: # This construct reduces the amount of object that needs to be created for operators and punctuation. # The length is pre-calculated for all singleton tokens. The length is used both to signal the length of # the token, and to advance the scanner position (without having to advance it with a scan(regexp)). # TOKEN_LBRACK = [:LBRACK, '['.freeze, 1].freeze TOKEN_LISTSTART = [:LISTSTART, '['.freeze, 1].freeze TOKEN_RBRACK = [:RBRACK, ']'.freeze, 1].freeze TOKEN_LBRACE = [:LBRACE, '{'.freeze, 1].freeze TOKEN_RBRACE = [:RBRACE, '}'.freeze, 1].freeze TOKEN_SELBRACE = [:SELBRACE, '{'.freeze, 1].freeze TOKEN_LPAREN = [:LPAREN, '('.freeze, 1].freeze TOKEN_RPAREN = [:RPAREN, ')'.freeze, 1].freeze TOKEN_EQUALS = [:EQUALS, '='.freeze, 1].freeze TOKEN_APPENDS = [:APPENDS, '+='.freeze, 2].freeze TOKEN_DELETES = [:DELETES, '-='.freeze, 2].freeze TOKEN_ISEQUAL = [:ISEQUAL, '=='.freeze, 2].freeze TOKEN_NOTEQUAL = [:NOTEQUAL, '!='.freeze, 2].freeze TOKEN_MATCH = [:MATCH, '=~'.freeze, 2].freeze TOKEN_NOMATCH = [:NOMATCH, '!~'.freeze, 2].freeze TOKEN_GREATEREQUAL = [:GREATEREQUAL, '>='.freeze, 2].freeze TOKEN_GREATERTHAN = [:GREATERTHAN, '>'.freeze, 1].freeze TOKEN_LESSEQUAL = [:LESSEQUAL, '<='.freeze, 2].freeze TOKEN_LESSTHAN = [:LESSTHAN, '<'.freeze, 1].freeze TOKEN_FARROW = [:FARROW, '=>'.freeze, 2].freeze TOKEN_PARROW = [:PARROW, '+>'.freeze, 2].freeze TOKEN_LSHIFT = [:LSHIFT, '<<'.freeze, 2].freeze TOKEN_LLCOLLECT = [:LLCOLLECT, '<<|'.freeze, 3].freeze TOKEN_LCOLLECT = [:LCOLLECT, '<|'.freeze, 2].freeze TOKEN_RSHIFT = [:RSHIFT, '>>'.freeze, 2].freeze TOKEN_RRCOLLECT = [:RRCOLLECT, '|>>'.freeze, 3].freeze TOKEN_RCOLLECT = [:RCOLLECT, '|>'.freeze, 2].freeze TOKEN_PLUS = [:PLUS, '+'.freeze, 1].freeze TOKEN_MINUS = [:MINUS, '-'.freeze, 1].freeze TOKEN_DIV = [:DIV, '/'.freeze, 1].freeze TOKEN_TIMES = [:TIMES, '*'.freeze, 1].freeze TOKEN_MODULO = [:MODULO, '%'.freeze, 1].freeze TOKEN_NOT = [:NOT, '!'.freeze, 1].freeze TOKEN_DOT = [:DOT, '.'.freeze, 1].freeze TOKEN_PIPE = [:PIPE, '|'.freeze, 1].freeze TOKEN_AT = [:AT , '@'.freeze, 1].freeze TOKEN_ATAT = [:ATAT , '@@'.freeze, 2].freeze TOKEN_COLON = [:COLON, ':'.freeze, 1].freeze TOKEN_COMMA = [:COMMA, ','.freeze, 1].freeze TOKEN_SEMIC = [:SEMIC, ';'.freeze, 1].freeze TOKEN_QMARK = [:QMARK, '?'.freeze, 1].freeze TOKEN_TILDE = [:TILDE, '~'.freeze, 1].freeze # lexed but not an operator in Puppet TOKEN_REGEXP = [:REGEXP, nil, 0].freeze TOKEN_IN_EDGE = [:IN_EDGE, '->'.freeze, 2].freeze TOKEN_IN_EDGE_SUB = [:IN_EDGE_SUB, '~>'.freeze, 2].freeze TOKEN_OUT_EDGE = [:OUT_EDGE, '<-'.freeze, 2].freeze TOKEN_OUT_EDGE_SUB = [:OUT_EDGE_SUB, '<~'.freeze, 2].freeze # Tokens that are always unique to what has been lexed TOKEN_STRING = [:STRING, nil, 0].freeze + TOKEN_WORD = [:WORD, nil, 0].freeze TOKEN_DQPRE = [:DQPRE, nil, 0].freeze TOKEN_DQMID = [:DQPRE, nil, 0].freeze TOKEN_DQPOS = [:DQPRE, nil, 0].freeze TOKEN_NUMBER = [:NUMBER, nil, 0].freeze TOKEN_VARIABLE = [:VARIABLE, nil, 1].freeze TOKEN_VARIABLE_EMPTY = [:VARIABLE, ''.freeze, 1].freeze # HEREDOC has syntax as an argument. TOKEN_HEREDOC = [:HEREDOC, nil, 0].freeze # EPP_START is currently a marker token, may later get syntax TOKEN_EPPSTART = [:EPP_START, nil, 0].freeze TOKEN_EPPEND = [:EPP_END, '%>', 2].freeze TOKEN_EPPEND_TRIM = [:EPP_END_TRIM, '-%>', 3].freeze # This is used for unrecognized tokens, will always be a single character. This particular instance # is not used, but is kept here for documentation purposes. TOKEN_OTHER = [:OTHER, nil, 0] # Keywords are all singleton tokens with pre calculated lengths. # Booleans are pre-calculated (rather than evaluating the strings "false" "true" repeatedly. # KEYWORDS = { "case" => [:CASE, 'case', 4], "class" => [:CLASS, 'class', 5], "default" => [:DEFAULT, 'default', 7], "define" => [:DEFINE, 'define', 6], "if" => [:IF, 'if', 2], "elsif" => [:ELSIF, 'elsif', 5], "else" => [:ELSE, 'else', 4], "inherits" => [:INHERITS, 'inherits', 8], "node" => [:NODE, 'node', 4], "and" => [:AND, 'and', 3], "or" => [:OR, 'or', 2], "undef" => [:UNDEF, 'undef', 5], "false" => [:BOOLEAN, false, 5], "true" => [:BOOLEAN, true, 4], "in" => [:IN, 'in', 2], "unless" => [:UNLESS, 'unless', 6], "function" => [:FUNCTION, 'function', 8], } KEYWORDS.each {|k,v| v[1].freeze; v.freeze } KEYWORDS.freeze # Reverse lookup of keyword name to string KEYWORD_NAMES = {} KEYWORDS.each {|k, v| KEYWORD_NAMES[v[0]] = k } KEYWORD_NAMES.freeze PATTERN_WS = %r{[[:blank:]\r]+} # The single line comment includes the line ending. PATTERN_COMMENT = %r{#.*\r?} PATTERN_MLCOMMENT = %r{/\*(.*?)\*/}m PATTERN_REGEX = %r{/[^/\n]*/} PATTERN_REGEX_END = %r{/} PATTERN_REGEX_A = %r{\A/} # for replacement to "" PATTERN_REGEX_Z = %r{/\Z} # for replacement to "" PATTERN_REGEX_ESC = %r{\\/} # for replacement to "/" # The 3x patterns: # PATTERN_CLASSREF = %r{((::){0,1}[A-Z][-\w]*)+} # PATTERN_NAME = %r{((::)?[a-z0-9][-\w]*)(::[a-z0-9][-\w]*)*} # The NAME and CLASSREF in 4x are strict. Each segment must start with # a letter a-z and may not contain dashes (\w includes letters, digits and _). # PATTERN_CLASSREF = %r{((::){0,1}[A-Z][\w]*)+} PATTERN_NAME = %r{((::)?[a-z][\w]*)(::[a-z][\w]*)*} + PATTERN_BARE_WORD = %r{[a-z_](?:[\w-]*[\w])?} PATTERN_DOLLAR_VAR = %r{\$(::)?(\w+::)*\w+} PATTERN_NUMBER = %r{\b(?:0[xX][0-9A-Fa-f]+|0?\d+(?:\.\d+)?(?:[eE]-?\d+)?)\b} # PERFORMANCE NOTE: # Comparison against a frozen string is faster (than unfrozen). # STRING_BSLASH_BSLASH = '\\'.freeze attr_reader :locator def initialize() end # Clears the lexer state (it is not required to call this as it will be garbage collected # and the next lex call (lex_string, lex_file) will reset the internal state. # def clear() # not really needed, but if someone wants to ensure garbage is collected as early as possible @scanner = nil @locator = nil @lexing_context = nil end # Convenience method, and for compatibility with older lexer. Use the lex_string instead which allows # passing the path to use without first having to call file= (which reads the file if it exists). # (Bad form to use overloading of assignment operator for something that is not really an assignment. Also, # overloading of = does not allow passing more than one argument). # def string=(string) lex_string(string, '') end def lex_string(string, path='') initvars @scanner = StringScanner.new(string) @locator = Puppet::Pops::Parser::Locator.locator(string, path) end # Lexes an unquoted string. # @param string [String] the string to lex # @param locator [Puppet::Pops::Parser::Locator] the locator to use (a default is used if nil is given) # @param escapes [Array] array of character strings representing the escape sequences to transform # @param interpolate [Boolean] whether interpolation of expressions should be made or not. # def lex_unquoted_string(string, locator, escapes, interpolate) initvars @scanner = StringScanner.new(string) @locator = locator || Puppet::Pops::Parser::Locator.locator(string, '') @lexing_context[:escapes] = escapes || UQ_ESCAPES @lexing_context[:uq_slurp_pattern] = (interpolate || !escapes.empty?) ? SLURP_UQ_PATTERN : SLURP_ALL_PATTERN end # Convenience method, and for compatibility with older lexer. Use the lex_file instead. # (Bad form to use overloading of assignment operator for something that is not really an assignment). # def file=(file) lex_file(file) end # TODO: This method should not be used, callers should get the locator since it is most likely required to # compute line, position etc given offsets. # def file @locator ? @locator.file : nil end # Initializes lexing of the content of the given file. An empty string is used if the file does not exist. # def lex_file(file) initvars contents = Puppet::FileSystem.exist?(file) ? Puppet::FileSystem.read(file) : "" @scanner = StringScanner.new(contents.freeze) @locator = Puppet::Pops::Parser::Locator.locator(contents, file) end def initvars @token_queue = [] # NOTE: additional keys are used; :escapes, :uq_slurp_pattern, :newline_jump, :epp_* @lexing_context = { :brace_count => 0, :after => nil, } end # Scans all of the content and returns it in an array # Note that the terminating [false, false] token is included in the result. # def fullscan result = [] scan {|token, value| result.push([token, value]) } result end # A block must be passed to scan. It will be called with two arguments, a symbol for the token, # and an instance of LexerSupport::TokenValue # PERFORMANCE NOTE: The TokenValue is designed to reduce the amount of garbage / temporary data # and to only convert the lexer's internal tokens on demand. It is slightly more costly to create an # instance of a class defined in Ruby than an Array or Hash, but the gain is much bigger since transformation # logic is avoided for many of its members (most are never used (e.g. line/pos information which is only of # value in general for error messages, and for some expressions (which the lexer does not know about). # def scan # PERFORMANCE note: it is faster to access local variables than instance variables. # This makes a small but notable difference since instance member access is avoided for # every token in the lexed content. # scn = @scanner ctx = @lexing_context queue = @token_queue lex_error_without_pos("Internal Error: No string or file given to lexer to process.") unless scn scn.skip(PATTERN_WS) # This is the lexer's main loop until queue.empty? && scn.eos? do if token = queue.shift || lex_token yield [ ctx[:after] = token[0], token[1] ] end end # Signals end of input yield [false, false] end # This lexes one token at the current position of the scanner. # PERFORMANCE NOTE: Any change to this logic should be performance measured. # def lex_token # Using three char look ahead (may be faster to do 2 char look ahead since only 2 tokens require a third scn = @scanner ctx = @lexing_context before = @scanner.pos # A look ahead of 3 characters is used since the longest operator ambiguity is resolved at that point. # PERFORMANCE NOTE: It is faster to peek once and use three separate variables for lookahead 0, 1 and 2. # la = scn.peek(3) return nil if la.empty? # Ruby 1.8.7 requires using offset and length (or integers are returned. # PERFORMANCE NOTE. # It is slightly faster to use these local variables than accessing la[0], la[1] etc. in ruby 1.9.3 # But not big enough to warrant two completely different implementations. # la0 = la[0,1] la1 = la[1,1] la2 = la[2,1] # PERFORMANCE NOTE: # A case when, where all the cases are literal values is the fastest way to map from data to code. # It is much faster than using a hash with lambdas, hash with symbol used to then invoke send etc. # This case statement is evaluated for most character positions in puppet source, and great care must # be taken to not introduce performance regressions. # case la0 when '.' emit(TOKEN_DOT, before) when ',' emit(TOKEN_COMMA, before) when '[' if ctx[:after] == :NAME && (before == 0 || scn.string[before-1,1] =~ /[[:blank:]\r\n]+/) emit(TOKEN_LISTSTART, before) else emit(TOKEN_LBRACK, before) end when ']' emit(TOKEN_RBRACK, before) when '(' emit(TOKEN_LPAREN, before) when ')' emit(TOKEN_RPAREN, before) when ';' emit(TOKEN_SEMIC, before) when '?' emit(TOKEN_QMARK, before) when '*' emit(TOKEN_TIMES, before) when '%' if la1 == '>' && ctx[:epp_mode] scn.pos += 2 if ctx[:epp_mode] == :expr enqueue_completed(TOKEN_EPPEND, before) end ctx[:epp_mode] = :text interpolate_epp else emit(TOKEN_MODULO, before) end when '{' # The lexer needs to help the parser since the technology used cannot deal with # lookahead of same token with different precedence. This is solved by making left brace # after ? into a separate token. # ctx[:brace_count] += 1 emit(if ctx[:after] == :QMARK TOKEN_SELBRACE else TOKEN_LBRACE end, before) when '}' ctx[:brace_count] -= 1 emit(TOKEN_RBRACE, before) # TOKENS @, @@, @( when '@' case la1 when '@' emit(TOKEN_ATAT, before) # TODO; Check if this is good for the grammar when '(' heredoc else emit(TOKEN_AT, before) end # TOKENS |, |>, |>> when '|' emit(case la1 when '>' la2 == '>' ? TOKEN_RRCOLLECT : TOKEN_RCOLLECT else TOKEN_PIPE end, before) # TOKENS =, =>, ==, =~ when '=' emit(case la1 when '=' TOKEN_ISEQUAL when '>' TOKEN_FARROW when '~' TOKEN_MATCH else TOKEN_EQUALS end, before) # TOKENS '+', '+=', and '+>' when '+' emit(case la1 when '=' TOKEN_APPENDS when '>' TOKEN_PARROW else TOKEN_PLUS end, before) # TOKENS '-', '->', and epp '-%>' (end of interpolation with trim) when '-' if ctx[:epp_mode] && la1 == '%' && la2 == '>' scn.pos += 3 if ctx[:epp_mode] == :expr enqueue_completed(TOKEN_EPPEND_TRIM, before) end interpolate_epp(:with_trim) else emit(case la1 when '>' TOKEN_IN_EDGE when '=' TOKEN_DELETES else TOKEN_MINUS end, before) end # TOKENS !, !=, !~ when '!' emit(case la1 when '=' TOKEN_NOTEQUAL when '~' TOKEN_NOMATCH else TOKEN_NOT end, before) # TOKENS ~>, ~ when '~' emit(la1 == '>' ? TOKEN_IN_EDGE_SUB : TOKEN_TILDE, before) when '#' scn.skip(PATTERN_COMMENT) nil # TOKENS '/', '/*' and '/ regexp /' when '/' case la1 when '*' scn.skip(PATTERN_MLCOMMENT) nil else # regexp position is a regexp, else a div if regexp_acceptable? && value = scn.scan(PATTERN_REGEX) # Ensure an escaped / was not matched while value[-2..-2] == STRING_BSLASH_BSLASH # i.e. \\ value += scn.scan_until(PATTERN_REGEX_END) end regex = value.sub(PATTERN_REGEX_A, '').sub(PATTERN_REGEX_Z, '').gsub(PATTERN_REGEX_ESC, '/') emit_completed([:REGEX, Regexp.new(regex), scn.pos-before], before) else emit(TOKEN_DIV, before) end end # TOKENS <, <=, <|, <<|, <<, <-, <~ when '<' emit(case la1 when '<' if la2 == '|' TOKEN_LLCOLLECT else TOKEN_LSHIFT end when '=' TOKEN_LESSEQUAL when '|' TOKEN_LCOLLECT when '-' TOKEN_OUT_EDGE when '~' TOKEN_OUT_EDGE_SUB else TOKEN_LESSTHAN end, before) # TOKENS >, >=, >> when '>' emit(case la1 when '>' TOKEN_RSHIFT when '=' TOKEN_GREATEREQUAL else TOKEN_GREATERTHAN end, before) # TOKENS :, ::CLASSREF, ::NAME when ':' if la1 == ':' before = scn.pos # PERFORMANCE NOTE: This could potentially be speeded up by using a case/when listing all # upper case letters. Alternatively, the 'A', and 'Z' comparisons may be faster if they are # frozen. # if la2 >= 'A' && la2 <= 'Z' # CLASSREF or error value = scn.scan(PATTERN_CLASSREF) if value after = scn.pos emit_completed([:CLASSREF, value, after-before], before) else # move to faulty position ('::' was ok) scn.pos = scn.pos + 3 lex_error("Illegal fully qualified class reference") end else # NAME or error value = scn.scan(PATTERN_NAME) if value emit_completed([:NAME, value, scn.pos-before], before) else # move to faulty position ('::' was ok) scn.pos = scn.pos + 2 lex_error("Illegal fully qualified name") end end else emit(TOKEN_COLON, before) end when '$' if value = scn.scan(PATTERN_DOLLAR_VAR) emit_completed([:VARIABLE, value[1..-1], scn.pos - before], before) else # consume the $ and let higher layer complain about the error instead of getting a syntax error emit(TOKEN_VARIABLE_EMPTY, before) end when '"' # Recursive string interpolation, 'interpolate' either returns a STRING token, or # a DQPRE with the rest of the string's tokens placed in the @token_queue interpolate_dq when "'" emit_completed([:STRING, slurp_sqstring, before-scn.pos], before) when '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' value = scn.scan(PATTERN_NUMBER) if value length = scn.pos - before assert_numeric(value, length) emit_completed([:NUMBER, value, length], before) else # move to faulty position ([0-9] was ok) scn.pos = scn.pos + 1 lex_error("Illegal number") end when 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '_' value = scn.scan(PATTERN_NAME) - # NAME or false start because followed by hyphen(s) and word - if value && !scn.match?(/-+\w/) + # NAME or false start because followed by hyphen(s), underscore or word + if value && !scn.match?(/^-+\w/) emit_completed(KEYWORDS[value] || [:NAME, value, scn.pos - before], before) else # Restart and check entire pattern (for ease of detecting non allowed trailing hyphen) scn.pos = before value = scn.scan(PATTERN_BARE_WORD) - if value - emit_completed([:STRING, value, scn.pos - before], before) + # If the WORD continues with :: it must be a correct fully qualified name + if value && !(fully_qualified = scn.match?(/::/)) + emit_completed([:WORD, value, scn.pos - before], before) else - # move to faulty position ([a-z] was ok) + # move to faulty position ([a-z_] was ok) scn.pos = scn.pos + 1 - lex_error("Illegal name") + if fully_qualified + lex_error("Illegal fully qualified name") + else + lex_error("Illegal name or bare word") + end end end when 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' value = scn.scan(PATTERN_CLASSREF) if value emit_completed([:CLASSREF, value, scn.pos - before], before) else # move to faulty position ([A-Z] was ok) scn.pos = scn.pos + 1 lex_error("Illegal class reference") end when "\n" # If heredoc_cont is in effect there are heredoc text lines to skip over # otherwise just skip the newline. # if ctx[:newline_jump] scn.pos = ctx[:newline_jump] ctx[:newline_jump] = nil else scn.pos += 1 end return nil when ' ', "\t", "\r" scn.skip(PATTERN_WS) return nil else # In case of unicode spaces of various kinds that are captured by a regexp, but not by the # simpler case expression above (not worth handling those special cases with better performance). if scn.skip(PATTERN_WS) nil else # "unrecognized char" emit([:OTHER, la0, 1], before) end end end # Emits (produces) a token [:tokensymbol, TokenValue] and moves the scanner's position past the token # def emit(token, byte_offset) @scanner.pos = byte_offset + token[2] [token[0], TokenValue.new(token, byte_offset, @locator)] end # Emits the completed token on the form [:tokensymbol, TokenValue. This method does not alter # the scanner's position. # def emit_completed(token, byte_offset) [token[0], TokenValue.new(token, byte_offset, @locator)] end # Enqueues a completed token at the given offset def enqueue_completed(token, byte_offset) @token_queue << emit_completed(token, byte_offset) end # Allows subprocessors for heredoc etc to enqueue tokens that are tokenized by a different lexer instance # def enqueue(emitted_token) @token_queue << emitted_token end # Answers after which tokens it is acceptable to lex a regular expression. # PERFORMANCE NOTE: # It may be beneficial to turn this into a hash with default value of true for missing entries. # A case expression with literal values will however create a hash internally. Since a reference is # always needed to the hash, this access is almost as costly as a method call. # def regexp_acceptable? case @lexing_context[:after] # Ends of (potential) R-value generating expressions when :RPAREN, :RBRACK, :RRCOLLECT, :RCOLLECT false # End of (potential) R-value - but must be allowed because of case expressions # Called out here to not be mistaken for a bug. when :RBRACE true # Operands (that can be followed by DIV (even if illegal in grammar) when :NAME, :CLASSREF, :NUMBER, :STRING, :BOOLEAN, :DQPRE, :DQMID, :DQPOST, :HEREDOC, :REGEX false else true end end end diff --git a/spec/unit/pops/evaluator/evaluating_parser_spec.rb b/spec/unit/pops/evaluator/evaluating_parser_spec.rb index 44af0ead9..210b55b20 100644 --- a/spec/unit/pops/evaluator/evaluating_parser_spec.rb +++ b/spec/unit/pops/evaluator/evaluating_parser_spec.rb @@ -1,1070 +1,1080 @@ require 'spec_helper' require 'puppet/pops' require 'puppet/pops/evaluator/evaluator_impl' require 'puppet_spec/pops' require 'puppet_spec/scope' require 'puppet/parser/e4_parser_adapter' # relative to this spec file (./) does not work as this file is loaded by rspec #require File.join(File.dirname(__FILE__), '/evaluator_rspec_helper') describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do include PuppetSpec::Pops include PuppetSpec::Scope before(:each) do Puppet[:strict_variables] = true # These must be set since the is 3x logic that triggers on these even if the tests are explicit # about selection of parser and evaluator # Puppet[:parser] = 'future' Puppet[:evaluator] = 'future' # Puppetx cannot be loaded until the correct parser has been set (injector is turned off otherwise) require 'puppetx' end let(:parser) { Puppet::Pops::Parser::EvaluatingParser::Transitional.new } let(:node) { 'node.example.com' } let(:scope) { s = create_test_scope_for_node(node); s } types = Puppet::Pops::Types::TypeFactory context "When evaluator evaluates literals" do { "1" => 1, "010" => 8, "0x10" => 16, "3.14" => 3.14, "0.314e1" => 3.14, "31.4e-1" => 3.14, "'1'" => '1', "'banana'" => 'banana', '"banana"' => 'banana', "banana" => 'banana', "banana::split" => 'banana::split', "false" => false, "true" => true, "Array" => types.array_of_data(), "/.*/" => /.*/ }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end end context "When the evaluator evaluates Lists and Hashes" do { "[]" => [], "[1,2,3]" => [1,2,3], "[1,[2.0, 2.1, [2.2]],[3.0, 3.1]]" => [1,[2.0, 2.1, [2.2]],[3.0, 3.1]], "[2 + 2]" => [4], "[1,2,3] == [1,2,3]" => true, "[1,2,3] != [2,3,4]" => true, "[1,2,3] == [2,2,3]" => false, "[1,2,3] != [1,2,3]" => false, "[1,2,3][2]" => 3, "[1,2,3] + [4,5]" => [1,2,3,4,5], "[1,2,3] + [[4,5]]" => [1,2,3,[4,5]], "[1,2,3] + 4" => [1,2,3,4], "[1,2,3] << [4,5]" => [1,2,3,[4,5]], "[1,2,3] << {'a' => 1, 'b'=>2}" => [1,2,3,{'a' => 1, 'b'=>2}], "[1,2,3] << 4" => [1,2,3,4], "[1,2,3,4] - [2,3]" => [1,4], "[1,2,3,4] - [2,5]" => [1,3,4], "[1,2,3,4] - 2" => [1,3,4], "[1,2,3,[2],4] - 2" => [1,3,[2],4], "[1,2,3,[2,3],4] - [[2,3]]" => [1,2,3,4], "[1,2,3,3,2,4,2,3] - [2,3]" => [1,4], "[1,2,3,['a',1],['b',2]] - {'a' => 1, 'b'=>2}" => [1,2,3], "[1,2,3,{'a'=>1,'b'=>2}] - [{'a' => 1, 'b'=>2}]" => [1,2,3], }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "[1,2,3] + {'a' => 1, 'b'=>2}" => [1,2,3,['a',1],['b',2]], }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do # This test must be done with match_array since the order of the hash # is undefined and Ruby 1.8.7 and 1.9.3 produce different results. expect(parser.evaluate_string(scope, source, __FILE__)).to match_array(result) end end { "[1,2,3][a]" => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end { "{}" => {}, "{'a'=>1,'b'=>2}" => {'a'=>1,'b'=>2}, "{'a'=>1,'b'=>{'x'=>2.1,'y'=>2.2}}" => {'a'=>1,'b'=>{'x'=>2.1,'y'=>2.2}}, "{'a'=> 2 + 2}" => {'a'=> 4}, "{'a'=> 1, 'b'=>2} == {'a'=> 1, 'b'=>2}" => true, "{'a'=> 1, 'b'=>2} != {'x'=> 1, 'b'=>2}" => true, "{'a'=> 1, 'b'=>2} == {'a'=> 2, 'b'=>3}" => false, "{'a'=> 1, 'b'=>2} != {'a'=> 1, 'b'=>2}" => false, "{a => 1, b => 2}[b]" => 2, "{2+2 => sum, b => 2}[4]" => 'sum', "{'a'=>1, 'b'=>2} + {'c'=>3}" => {'a'=>1,'b'=>2,'c'=>3}, "{'a'=>1, 'b'=>2} + {'b'=>3}" => {'a'=>1,'b'=>3}, "{'a'=>1, 'b'=>2} + ['c', 3, 'b', 3]" => {'a'=>1,'b'=>3, 'c'=>3}, "{'a'=>1, 'b'=>2} + [['c', 3], ['b', 3]]" => {'a'=>1,'b'=>3, 'c'=>3}, "{'a'=>1, 'b'=>2} - {'b' => 3}" => {'a'=>1}, "{'a'=>1, 'b'=>2, 'c'=>3} - ['b', 'c']" => {'a'=>1}, "{'a'=>1, 'b'=>2, 'c'=>3} - 'c'" => {'a'=>1, 'b'=>2}, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "{'a' => 1, 'b'=>2} << 1" => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end end context "When the evaluator perform comparisons" do { "'a' == 'a'" => true, "'a' == 'b'" => false, "'a' != 'a'" => false, "'a' != 'b'" => true, "'a' < 'b' " => true, "'a' < 'a' " => false, "'b' < 'a' " => false, "'a' <= 'b'" => true, "'a' <= 'a'" => true, "'b' <= 'a'" => false, "'a' > 'b' " => false, "'a' > 'a' " => false, "'b' > 'a' " => true, "'a' >= 'b'" => false, "'a' >= 'a'" => true, "'b' >= 'a'" => true, "'a' == 'A'" => true, "'a' != 'A'" => false, "'a' > 'A'" => false, "'a' >= 'A'" => true, "'A' < 'a'" => false, "'A' <= 'a'" => true, "1 == 1" => true, "1 == 2" => false, "1 != 1" => false, "1 != 2" => true, "1 < 2 " => true, "1 < 1 " => false, "2 < 1 " => false, "1 <= 2" => true, "1 <= 1" => true, "2 <= 1" => false, "1 > 2 " => false, "1 > 1 " => false, "2 > 1 " => true, "1 >= 2" => false, "1 >= 1" => true, "2 >= 1" => true, "1 == 1.0 " => true, "1 < 1.1 " => true, "'1' < 1.1" => true, "1.0 == 1 " => true, "1.0 < 2 " => true, "1.0 < 'a'" => true, "'1.0' < 1.1" => true, "'1.0' < 'a'" => true, "'1.0' < '' " => true, "'1.0' < ' '" => true, "'a' > '1.0'" => true, "/.*/ == /.*/ " => true, "/.*/ != /a.*/" => true, "true == true " => true, "false == false" => true, "true == false" => false, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "'a' =~ /.*/" => true, "'a' =~ '.*'" => true, "/.*/ != /a.*/" => true, "'a' !~ /b.*/" => true, "'a' !~ 'b.*'" => true, '$x = a; a =~ "$x.*"' => true, "a =~ Pattern['a.*']" => true, "a =~ Regexp['a.*']" => true, "$x = /a.*/ a =~ $x" => true, "$x = Pattern['a.*'] a =~ $x" => true, "1 =~ Integer" => true, "1 !~ Integer" => false, "[1,2,3] =~ Array[Integer[1,10]]" => true, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "666 =~ /6/" => :error, "[a] =~ /a/" => :error, "{a=>1} =~ /a/" => :error, "/a/ =~ /a/" => :error, "Array =~ /A/" => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end { "1 in [1,2,3]" => true, "4 in [1,2,3]" => false, "a in {x=>1, a=>2}" => true, "z in {x=>1, a=>2}" => false, "ana in bananas" => true, "xxx in bananas" => false, "/ana/ in bananas" => true, "/xxx/ in bananas" => false, "ANA in bananas" => false, # ANA is a type, not a String "'ANA' in bananas" => true, "ana in 'BANANAS'" => true, "/ana/ in 'BANANAS'" => false, "/ANA/ in 'BANANAS'" => true, "xxx in 'BANANAS'" => false, "[2,3] in [1,[2,3],4]" => true, "[2,4] in [1,[2,3],4]" => false, "[a,b] in ['A',['A','B'],'C']" => true, "[x,y] in ['A',['A','B'],'C']" => false, "a in {a=>1}" => true, "x in {a=>1}" => false, "'A' in {a=>1}" => true, "'X' in {a=>1}" => false, "a in {'A'=>1}" => true, "x in {'A'=>1}" => false, "/xxx/ in {'aaaxxxbbb'=>1}" => true, "/yyy/ in {'aaaxxxbbb'=>1}" => false, "15 in [1, 0xf]" => true, "15 in [1, '0xf']" => true, "'15' in [1, 0xf]" => true, "15 in [1, 115]" => false, "1 in [11, '111']" => false, "'1' in [11, '111']" => false, "Array[Integer] in [2, 3]" => false, "Array[Integer] in [2, [3, 4]]" => true, "Array[Integer] in [2, [a, 4]]" => false, "Integer in { 2 =>'a'}" => true, "Integer[5,10] in [1,5,3]" => true, "Integer[5,10] in [1,2,3]" => false, "Integer in {'a'=>'a'}" => false, "Integer in {'a'=>1}" => false, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { 'Object' => ['Data', 'Scalar', 'Numeric', 'Integer', 'Float', 'Boolean', 'String', 'Pattern', 'Collection', 'Array', 'Hash', 'CatalogEntry', 'Resource', 'Class', 'Undef', 'File', 'NotYetKnownResourceType'], # Note, Data > Collection is false (so not included) 'Data' => ['Scalar', 'Numeric', 'Integer', 'Float', 'Boolean', 'String', 'Pattern', 'Array', 'Hash',], 'Scalar' => ['Numeric', 'Integer', 'Float', 'Boolean', 'String', 'Pattern'], 'Numeric' => ['Integer', 'Float'], 'CatalogEntry' => ['Class', 'Resource', 'File', 'NotYetKnownResourceType'], 'Integer[1,10]' => ['Integer[2,3]'], }.each do |general, specials| specials.each do |special | it "should compute that #{general} > #{special}" do parser.evaluate_string(scope, "#{general} > #{special}", __FILE__).should == true end it "should compute that #{special} < #{general}" do parser.evaluate_string(scope, "#{special} < #{general}", __FILE__).should == true end it "should compute that #{general} != #{special}" do parser.evaluate_string(scope, "#{special} != #{general}", __FILE__).should == true end end end { 'Integer[1,10] > Integer[2,3]' => true, 'Integer[1,10] == Integer[2,3]' => false, 'Integer[1,10] > Integer[0,5]' => false, 'Integer[1,10] > Integer[1,10]' => false, 'Integer[1,10] >= Integer[1,10]' => true, 'Integer[1,10] == Integer[1,10]' => true, }.each do |source, result| it "should parse and evaluate the integer range comparison expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end end context "When the evaluator performs arithmetic" do context "on Integers" do { "2+2" => 4, "2 + 2" => 4, "7 - 3" => 4, "6 * 3" => 18, "6 / 3" => 2, "6 % 3" => 0, "10 % 3" => 1, "-(6/3)" => -2, "-6/3 " => -2, "8 >> 1" => 4, "8 << 1" => 16, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end context "on Floats" do { "2.2 + 2.2" => 4.4, "7.7 - 3.3" => 4.4, "6.1 * 3.1" => 18.91, "6.6 / 3.3" => 2.0, "-(6.0/3.0)" => -2.0, "-6.0/3.0 " => -2.0, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "3.14 << 2" => :error, "3.14 >> 2" => :error, "6.6 % 3.3" => 0.0, "10.0 % 3.0" => 1.0, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end end context "on strings requiring boxing to Numeric" do { "'2' + '2'" => 4, "'2.2' + '2.2'" => 4.4, "'0xF7' + '010'" => 0xFF, "'0xF7' + '0x8'" => 0xFF, "'0367' + '010'" => 0xFF, "'012.3' + '010'" => 20.3, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "'0888' + '010'" => :error, "'0xWTF' + '010'" => :error, "'0x12.3' + '010'" => :error, "'0x12.3' + '010'" => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end end end end # arithmetic context "When the evaluator evaluates assignment" do { "$a = 5" => 5, "$a = 5; $a" => 5, "$a = 5; $b = 6; $a" => 5, "$a = $b = 5; $a == $b" => true, "$a = [1,2,3]; [x].map |$x| { $a += x; $a }" => [[1,2,3,'x']], "$a = [a,x,c]; [x].map |$x| { $a -= x; $a }" => [['a','c']], }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "[a,b,c] = [1,2,3]; $a == 1 and $b == 2 and $c == 3" => :error, "[a,b,c] = {b=>2,c=>3,a=>1}; $a == 1 and $b == 2 and $c == 3" => :error, "$a = [1,2,3]; [x].collect |$x| { [a] += x; $a }" => :error, "$a = [a,x,c]; [x].collect |$x| { [a] -= x; $a }" => :error, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(Puppet::ParseError) end end end context "When the evaluator evaluates conditionals" do { "if true {5}" => 5, "if false {5}" => nil, "if false {2} else {5}" => 5, "if false {2} elsif true {5}" => 5, "if false {2} elsif false {5}" => nil, "unless false {5}" => 5, "unless true {5}" => nil, "unless true {2} else {5}" => 5, "$a = if true {5} $a" => 5, "$a = if false {5} $a" => nil, "$a = if false {2} else {5} $a" => 5, "$a = if false {2} elsif true {5} $a" => 5, "$a = if false {2} elsif false {5} $a" => nil, "$a = unless false {5} $a" => 5, "$a = unless true {5} $a" => nil, "$a = unless true {2} else {5} $a" => 5, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "case 1 { 1 : { yes } }" => 'yes', "case 2 { 1,2,3 : { yes} }" => 'yes', "case 2 { 1,3 : { no } 2: { yes} }" => 'yes', "case 2 { 1,3 : { no } 5: { no } default: { yes }}" => 'yes', "case 2 { 1,3 : { no } 5: { no } }" => nil, "case 'banana' { 1,3 : { no } /.*ana.*/: { yes } }" => 'yes', "case 'banana' { /.*(ana).*/: { $1 } }" => 'ana', "case [1] { Array : { yes } }" => 'yes', "case [1] { Array[String] : { no } Array[Integer]: { yes } }" => 'yes', "case 1 { Integer : { yes } Type[Integer] : { no } }" => 'yes', "case Integer { Integer : { no } Type[Integer] : { yes } }" => 'yes', }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "2 ? { 1 => no, 2 => yes}" => 'yes', "3 ? { 1 => no, 2 => no}" => nil, "3 ? { 1 => no, 2 => no, default => yes }" => 'yes', "3 ? { 1 => no, default => yes, 3 => no }" => 'yes', "'banana' ? { /.*(ana).*/ => $1 }" => 'ana', "[2] ? { Array[String] => yes, Array => yes}" => 'yes', }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end end context "When evaluator performs [] operations" do { "[1,2,3][0]" => 1, "[1,2,3][2]" => 3, "[1,2,3][3]" => nil, "[1,2,3][-1]" => 3, "[1,2,3][-2]" => 2, "[1,2,3][-4]" => nil, "[1,2,3,4][0,2]" => [1,2], "[1,2,3,4][1,3]" => [2,3,4], "[1,2,3,4][-2,2]" => [3,4], "[1,2,3,4][-3,2]" => [2,3], "[1,2,3,4][3,5]" => [4], "[1,2,3,4][5,2]" => [], "[1,2,3,4][0,-1]" => [1,2,3,4], "[1,2,3,4][0,-2]" => [1,2,3], "[1,2,3,4][0,-4]" => [1], "[1,2,3,4][0,-5]" => [], "[1,2,3,4][-5,2]" => [1], "[1,2,3,4][-5,-3]" => [1,2], "[1,2,3,4][-6,-3]" => [1,2], "[1,2,3,4][2,-3]" => [], }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "{a=>1, b=>2, c=>3}[a]" => 1, "{a=>1, b=>2, c=>3}[c]" => 3, "{a=>1, b=>2, c=>3}[x]" => nil, "{a=>1, b=>2, c=>3}[c,b]" => [3,2], "{a=>1, b=>2, c=>3}[a,b,c]" => [1,2,3], "{a=>{b=>{c=>'it works'}}}[a][b][c]" => 'it works', "$a = {undef => 10} $a[free_lunch]" => nil, "$a = {undef => 10} $a[undef]" => 10, "$a = {undef => 10} $a[$a[free_lunch]]" => 10, "$a = {} $a[free_lunch] == undef" => true, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "'abc'[0]" => 'a', "'abc'[2]" => 'c', "'abc'[-1]" => 'c', "'abc'[-2]" => 'b', "'abc'[-3]" => 'a', "'abc'[-4]" => '', "'abc'[3]" => '', "abc[0]" => 'a', "abc[2]" => 'c', "abc[-1]" => 'c', "abc[-2]" => 'b', "abc[-3]" => 'a', "abc[-4]" => '', "abc[3]" => '', "'abcd'[0,2]" => 'ab', "'abcd'[1,3]" => 'bcd', "'abcd'[-2,2]" => 'cd', "'abcd'[-3,2]" => 'bc', "'abcd'[3,5]" => 'd', "'abcd'[5,2]" => '', "'abcd'[0,-1]" => 'abcd', "'abcd'[0,-2]" => 'abc', "'abcd'[0,-4]" => 'a', "'abcd'[0,-5]" => '', "'abcd'[-5,2]" => 'a', "'abcd'[-5,-3]" => 'ab', "'abcd'[-6,-3]" => 'ab', "'abcd'[2,-3]" => '', }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end # Type operations (full set tested by tests covering type calculator) { "Array[Integer]" => types.array_of(types.integer), "Array[Integer,1]" => types.constrain_size(types.array_of(types.integer),1, :default), "Array[Integer,1,2]" => types.constrain_size(types.array_of(types.integer),1, 2), "Array[Integer,Integer[1,2]]" => types.constrain_size(types.array_of(types.integer),1, 2), "Array[Integer,Integer[1]]" => types.constrain_size(types.array_of(types.integer),1, :default), "Hash[Integer,Integer]" => types.hash_of(types.integer, types.integer), "Hash[Integer,Integer,1]" => types.constrain_size(types.hash_of(types.integer, types.integer),1, :default), "Hash[Integer,Integer,1,2]" => types.constrain_size(types.hash_of(types.integer, types.integer),1, 2), "Hash[Integer,Integer,Integer[1,2]]" => types.constrain_size(types.hash_of(types.integer, types.integer),1, 2), "Hash[Integer,Integer,Integer[1]]" => types.constrain_size(types.hash_of(types.integer, types.integer),1, :default), "Resource[File]" => types.resource('File'), "Resource['File']" => types.resource(types.resource('File')), "File[foo]" => types.resource('file', 'foo'), "File[foo, bar]" => [types.resource('file', 'foo'), types.resource('file', 'bar')], "Pattern[a, /b/, Pattern[c], Regexp[d]]" => types.pattern('a', 'b', 'c', 'd'), "String[1,2]" => types.constrain_size(types.string,1, 2), "String[Integer[1,2]]" => types.constrain_size(types.string,1, 2), "String[Integer[1]]" => types.constrain_size(types.string,1, :default), }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end # LHS where [] not supported, and missing key(s) { "Array[]" => :error, "'abc'[]" => :error, "Resource[]" => :error, "File[]" => :error, "String[]" => :error, "1[]" => :error, "3.14[]" => :error, "/.*/[]" => :error, "$a=[1] $a[]" => :error, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(/Syntax error/) end end # Errors when wrong number/type of keys are used { "Array[0]" => 'Array-Type[] arguments must be types. Got Fixnum', "Hash[0]" => 'Hash-Type[] arguments must be types. Got Fixnum', "Hash[Integer, 0]" => 'Hash-Type[] arguments must be types. Got Fixnum', "Array[Integer,1,2,3]" => 'Array-Type[] accepts 1 to 3 arguments. Got 4', "Array[Integer,String]" => "A Type's size constraint arguments must be a single Integer type, or 1-2 integers (or default). Got a String-Type", "Hash[Integer,String, 1,2,3]" => 'Hash-Type[] accepts 1 to 4 arguments. Got 5', "'abc'[x]" => "The value 'x' cannot be converted to Numeric", "'abc'[1.0]" => "A String[] cannot use Float where Integer is expected", "'abc'[1,2,3]" => "String supports [] with one or two arguments. Got 3", "Resource[0]" => 'First argument to Resource[] must be a resource type or a String. Got Fixnum', "Resource[a, 0]" => 'Error creating type specialization of a Resource-Type, Cannot use Fixnum where String is expected', "File[0]" => 'Error creating type specialization of a File-Type, Cannot use Fixnum where String is expected', "String[a]" => "A Type's size constraint arguments must be a single Integer type, or 1-2 integers (or default). Got a String", "Pattern[0]" => 'Error creating type specialization of a Pattern-Type, Cannot use Fixnum where String or Regexp or Pattern-Type or Regexp-Type is expected', "Regexp[0]" => 'Error creating type specialization of a Regexp-Type, Cannot use Fixnum where String or Regexp is expected', "Regexp[a,b]" => 'A Regexp-Type[] accepts 1 argument. Got 2', "true[0]" => "Operator '[]' is not applicable to a Boolean", "1[0]" => "Operator '[]' is not applicable to an Integer", "3.14[0]" => "Operator '[]' is not applicable to a Float", "/.*/[0]" => "Operator '[]' is not applicable to a Regexp", "[1][a]" => "The value 'a' cannot be converted to Numeric", "[1][0.0]" => "An Array[] cannot use Float where Integer is expected", "[1]['0.0']" => "An Array[] cannot use Float where Integer is expected", "[1,2][1, 0.0]" => "An Array[] cannot use Float where Integer is expected", "[1,2][1.0, -1]" => "An Array[] cannot use Float where Integer is expected", "[1,2][1, -1.0]" => "An Array[] cannot use Float where Integer is expected", }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(Regexp.new(Regexp.quote(result))) end end context "on catalog types" do it "[n] gets resource parameter [n]" do source = "notify { 'hello': message=>'yo'} Notify[hello][message]" parser.evaluate_string(scope, source, __FILE__).should == 'yo' end it "[n] gets class parameter [n]" do source = "class wonka($produces='chocolate'){ } include wonka Class[wonka][produces]" # This is more complicated since it needs to run like 3.x and do an import_ast adapted_parser = Puppet::Parser::E4ParserAdapter.new adapted_parser.file = __FILE__ ast = adapted_parser.parse(source) scope.known_resource_types.import_ast(ast, '') ast.code.safeevaluate(scope).should == 'chocolate' end # Resource default and override expressions and resource parameter access with [] { "notify { id: message=>explicit} Notify[id][message]" => "explicit", "Notify { message=>by_default} notify {foo:} Notify[foo][message]" => "by_default", "notify {foo:} Notify[foo]{message =>by_override} Notify[foo][message]" => "by_override", "notify { foo: tag => evoe} Notify[foo][tag]" => "evoe", # Does not produce the defaults for tag "notify { foo: } Notify[foo][tag]" => nil, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end # Resource default and override expressions and resource parameter access error conditions { "notify { xid: message=>explicit} Notify[id][message]" => /Resource not found/, "notify { id: message=>explicit} Notify[id][mustard]" => /does not have a parameter called 'mustard'/, # NOTE: these meta-esque parameters are not recognized as such "notify { id: message=>explicit} Notify[id][title]" => /does not have a parameter called 'title'/, "notify { id: message=>explicit} Notify[id]['type']" => /does not have a parameter called 'type'/, }.each do |source, result| it "should parse '#{source}' and raise error matching #{result}" do expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(result) end end context 'with errors' do { "Class['fail-whale']" => /Illegal name/, "Class[0]" => /An Integer cannot be used where a String is expected/, "Class[/.*/]" => /A Regexp cannot be used where a String is expected/, "Class[4.1415]" => /A Float cannot be used where a String is expected/, "Class[Integer]" => /An Integer-Type cannot be used where a String is expected/, "Class[File['tmp']]" => /A File\['tmp'\] Resource-Reference cannot be used where a String is expected/, }.each do | source, error_pattern| it "an error is flagged for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(error_pattern) end end end end # end [] operations end context "When the evaluator performs boolean operations" do { "true and true" => true, "false and true" => false, "true and false" => false, "false and false" => false, "true or true" => true, "false or true" => true, "true or false" => true, "false or false" => false, "! true" => false, "!! true" => true, "!! false" => false, "! 'x'" => false, "! ''" => true, "! undef" => true, "! [a]" => false, "! []" => false, "! {a=>1}" => false, "! {}" => false, "true and false and '0xwtf' + 1" => false, "false or true or '0xwtf' + 1" => true, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do parser.evaluate_string(scope, source, __FILE__).should == result end end { "false || false || '0xwtf' + 1" => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end end context "When evaluator performs operations on literal undef" do it "computes non existing hash lookup as undef" do parser.evaluate_string(scope, "{a => 1}[b] == undef", __FILE__).should == true parser.evaluate_string(scope, "undef == {a => 1}[b]", __FILE__).should == true end end context "When evaluator performs calls" do let(:populate) do parser.evaluate_string(scope, "$a = 10 $b = [1,2,3]") end { 'sprintf( "x%iy", $a )' => "x10y", '"x%iy".sprintf( $a )' => "x10y", '$b.reduce |$memo,$x| { $memo + $x }' => 6, 'reduce($b) |$memo,$x| { $memo + $x }' => 6, }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do populate parser.evaluate_string(scope, source, __FILE__).should == result end end { '"value is ${a*2} yo"' => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end it "provides location information on error in unparenthesized call logic" do expect{parser.evaluate_string(scope, "include non_existing_class", __FILE__)}.to raise_error(Puppet::ParseError, /line 1\:1/) end end context "When evaluator performs string interpolation" do let(:populate) do parser.evaluate_string(scope, "$a = 10 $b = [1,2,3]") end { '"value is $a yo"' => "value is 10 yo", '"value is \$a yo"' => "value is $a yo", '"value is ${a} yo"' => "value is 10 yo", '"value is \${a} yo"' => "value is ${a} yo", '"value is ${$a} yo"' => "value is 10 yo", '"value is ${$a*2} yo"' => "value is 20 yo", '"value is ${sprintf("x%iy",$a)} yo"' => "value is x10y yo", '"value is ${"x%iy".sprintf($a)} yo"' => "value is x10y yo", '"value is ${[1,2,3]} yo"' => "value is [1, 2, 3] yo", '"value is ${/.*/} yo"' => "value is /.*/ yo", '$x = undef "value is $x yo"' => "value is yo", '$x = default "value is $x yo"' => "value is default yo", '$x = Array[Integer] "value is $x yo"' => "value is Array[Integer] yo", '"value is ${Array[Integer]} yo"' => "value is Array[Integer] yo", }.each do |source, result| it "should parse and evaluate the expression '#{source}' to #{result}" do populate parser.evaluate_string(scope, source, __FILE__).should == result end end it "should parse and evaluate an interpolation of a hash" do source = '"value is ${{a=>1,b=>2}} yo"' # This test requires testing against two options because a hash to string # produces a result that is unordered hashstr = {'a' => 1, 'b' => 2}.to_s alt_results = ["value is {a => 1, b => 2} yo", "value is {b => 2, a => 1} yo" ] populate parse_result = parser.evaluate_string(scope, source, __FILE__) alt_results.include?(parse_result).should == true end + it 'should accept a variable with leading underscore when used directly' do + source = '$_x = 10; "$_x"' + expect(parser.evaluate_string(scope, source, __FILE__)).to eql('10') + end + + it 'should accept a variable with leading underscore when used as an expression' do + source = '$_x = 10; "${_x}"' + expect(parser.evaluate_string(scope, source, __FILE__)).to eql('10') + end + { '"value is ${a*2} yo"' => :error, }.each do |source, result| it "should parse and raise error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError) end end end context "When evaluating variables" do context "that are non existing an error is raised for" do it "unqualified variable" do expect { parser.evaluate_string(scope, "$quantum_gravity", __FILE__) }.to raise_error(/Unknown variable/) end it "qualified variable" do expect { parser.evaluate_string(scope, "$quantum_gravity::graviton", __FILE__) }.to raise_error(/Unknown variable/) end end it "a lex error should be raised for '$foo::::bar'" do expect { parser.evaluate_string(scope, "$foo::::bar") }.to raise_error(Puppet::LexError, /Illegal fully qualified name at line 1:7/) end { '$a = $0' => nil, '$a = $1' => nil, }.each do |source, value| it "it is ok to reference numeric unassigned variables '#{source}'" do parser.evaluate_string(scope, source, __FILE__).should == value end end { '$00 = 0' => /must be a decimal value/, '$0xf = 0' => /must be a decimal value/, '$0777 = 0' => /must be a decimal value/, '$123a = 0' => /must be a decimal value/, }.each do |source, error_pattern| it "should raise an error for '#{source}'" do expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(error_pattern) end end context "an initial underscore in the last segment of a var name is allowed" do { '$_a = 1' => 1, '$__a = 1' => 1, }.each do |source, value| it "as in this example '#{source}'" do parser.evaluate_string(scope, source, __FILE__).should == value end end end end context "When evaluating relationships" do it 'should form a relation with File[a] -> File[b]' do source = "File[a] -> File[b]" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['File', 'a', '->', 'File', 'b']) end it 'should form a relation with resource -> resource' do source = "notify{a:} -> notify{b:}" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['Notify', 'a', '->', 'Notify', 'b']) end it 'should form a relation with [File[a], File[b]] -> [File[x], File[y]]' do source = "[File[a], File[b]] -> [File[x], File[y]]" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['File', 'a', '->', 'File', 'x']) scope.compiler.should have_relationship(['File', 'b', '->', 'File', 'x']) scope.compiler.should have_relationship(['File', 'a', '->', 'File', 'y']) scope.compiler.should have_relationship(['File', 'b', '->', 'File', 'y']) end it 'should tolerate (eliminate) duplicates in operands' do source = "[File[a], File[a]] -> File[x]" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['File', 'a', '->', 'File', 'x']) scope.compiler.relationships.size.should == 1 end it 'should form a relation with <-' do source = "File[a] <- File[b]" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['File', 'b', '->', 'File', 'a']) end it 'should form a relation with <-' do source = "File[a] <~ File[b]" parser.evaluate_string(scope, source, __FILE__) scope.compiler.should have_relationship(['File', 'b', '~>', 'File', 'a']) end end context "When evaluating heredoc" do it "evaluates plain heredoc" do src = "@(END)\nThis is\nheredoc text\nEND\n" parser.evaluate_string(scope, src).should == "This is\nheredoc text\n" end it "parses heredoc with margin" do src = [ "@(END)", " This is", " heredoc text", " | END", "" ].join("\n") parser.evaluate_string(scope, src).should == "This is\nheredoc text\n" end it "parses heredoc with margin and right newline trim" do src = [ "@(END)", " This is", " heredoc text", " |- END", "" ].join("\n") parser.evaluate_string(scope, src).should == "This is\nheredoc text" end it "parses escape specification" do src = <<-CODE @(END/t) Tex\\tt\\n |- END CODE parser.evaluate_string(scope, src).should == "Tex\tt\\n" end it "parses syntax checked specification" do src = <<-CODE @(END:json) ["foo", "bar"] |- END CODE parser.evaluate_string(scope, src).should == '["foo", "bar"]' end it "parses syntax checked specification with error and reports it" do src = <<-CODE @(END:json) ['foo', "bar"] |- END CODE expect { parser.evaluate_string(scope, src)}.to raise_error(/Cannot parse invalid JSON string/) end it "parses interpolated heredoc epression" do src = <<-CODE $name = 'Fjodor' @("END") Hello $name |- END CODE parser.evaluate_string(scope, src).should == "Hello Fjodor" end end context "Handles Deprecations and Discontinuations" do around(:each) do |example| Puppet.override({:loaders => Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))}, 'test') do example.run end end it 'of import statements' do source = "\nimport foo" # Error references position 5 at the opening '{' # Set file to nil to make it easier to match with line number (no file name in output) expect { parser.evaluate_string(scope, source) }.to raise_error(/'import' has been discontinued.*line 2:1/) end end context "Detailed Error messages are reported" do it 'for illegal type references' do source = '1+1 { "title": }' # Error references position 5 at the opening '{' # Set file to nil to make it easier to match with line number (no file name in output) expect { parser.parse_string(source, nil) }.to raise_error(/Expression is not valid as a resource.*line 1:5/) end it 'for non r-value producing <| |>' do expect { parser.parse_string("$a = File <| |>", nil) }.to raise_error(/A Virtual Query does not produce a value at line 1:6/) end it 'for non r-value producing <<| |>>' do expect { parser.parse_string("$a = File <<| |>>", nil) }.to raise_error(/An Exported Query does not produce a value at line 1:6/) end it 'for non r-value producing define' do Puppet.expects(:err).with("Invalid use of expression. A 'define' expression does not produce a value at line 1:6") Puppet.expects(:err).with("Classes, definitions, and nodes may only appear at toplevel or inside other classes at line 1:6") expect { parser.parse_string("$a = define foo { }", nil) }.to raise_error(/2 errors/) end it 'for non r-value producing class' do Puppet.expects(:err).with("Invalid use of expression. A Host Class Definition does not produce a value at line 1:6") Puppet.expects(:err).with("Classes, definitions, and nodes may only appear at toplevel or inside other classes at line 1:6") expect { parser.parse_string("$a = class foo { }", nil) }.to raise_error(/2 errors/) end it 'for unclosed quote with indication of start position of string' do source = <<-SOURCE.gsub(/^ {6}/,'') $a = "xx yyy SOURCE # first char after opening " reported as being in error. expect { parser.parse_string(source) }.to raise_error(/Unclosed quote after '"' followed by 'xx\\nyy\.\.\.' at line 1:7/) end it 'for multiple errors with a summary exception' do Puppet.expects(:err).with("Invalid use of expression. A Node Definition does not produce a value at line 1:6") Puppet.expects(:err).with("Classes, definitions, and nodes may only appear at toplevel or inside other classes at line 1:6") expect { parser.parse_string("$a = node x { }",nil) }.to raise_error(/2 errors/) end it 'for a bad hostname' do expect { parser.parse_string("node 'macbook+owned+by+name' { }", nil) }.to raise_error(/The hostname 'macbook\+owned\+by\+name' contains illegal characters.*at line 1:6/) end it 'for a hostname with interpolation' do source = <<-SOURCE.gsub(/^ {6}/,'') $name = 'fred' node "macbook-owned-by$name" { } SOURCE expect { parser.parse_string(source, nil) }.to raise_error(/An interpolated expression is not allowed in a hostname of a node at line 2:23/) end end matcher :have_relationship do |expected| calc = Puppet::Pops::Types::TypeCalculator.new match do |compiler| op_name = {'->' => :relationship, '~>' => :subscription} compiler.relationships.any? do | relation | relation.source.type == expected[0] && relation.source.title == expected[1] && relation.type == op_name[expected[2]] && relation.target.type == expected[3] && relation.target.title == expected[4] end end failure_message_for_should do |actual| "Relationship #{expected[0]}[#{expected[1]}] #{expected[2]} #{expected[3]}[#{expected[4]}] but was unknown to compiler" end end end diff --git a/spec/unit/pops/parser/lexer2_spec.rb b/spec/unit/pops/parser/lexer2_spec.rb index e8a035a3a..8ccdc2630 100644 --- a/spec/unit/pops/parser/lexer2_spec.rb +++ b/spec/unit/pops/parser/lexer2_spec.rb @@ -1,439 +1,447 @@ require 'spec_helper' require 'matchers/match_tokens2' require 'puppet/pops' require 'puppet/pops/parser/lexer2' module EgrammarLexer2Spec def tokens_scanned_from(s) lexer = Puppet::Pops::Parser::Lexer2.new lexer.string = s tokens = lexer.fullscan[0..-2] end def epp_tokens_scanned_from(s) lexer = Puppet::Pops::Parser::Lexer2.new lexer.string = s tokens = lexer.fullscan_epp[0..-2] end end describe 'Lexer2' do include EgrammarLexer2Spec { :LBRACK => '[', :RBRACK => ']', :LBRACE => '{', :RBRACE => '}', :LPAREN => '(', :RPAREN => ')', :EQUALS => '=', :ISEQUAL => '==', :GREATEREQUAL => '>=', :GREATERTHAN => '>', :LESSTHAN => '<', :LESSEQUAL => '<=', :NOTEQUAL => '!=', :NOT => '!', :COMMA => ',', :DOT => '.', :COLON => ':', :AT => '@', :LLCOLLECT => '<<|', :RRCOLLECT => '|>>', :LCOLLECT => '<|', :RCOLLECT => '|>', :SEMIC => ';', :QMARK => '?', :OTHER => '\\', :FARROW => '=>', :PARROW => '+>', :APPENDS => '+=', :DELETES => '-=', :PLUS => '+', :MINUS => '-', :DIV => '/', :TIMES => '*', :LSHIFT => '<<', :RSHIFT => '>>', :MATCH => '=~', :NOMATCH => '!~', :IN_EDGE => '->', :OUT_EDGE => '<-', :IN_EDGE_SUB => '~>', :OUT_EDGE_SUB => '<~', :PIPE => '|', }.each do |name, string| it "should lex a token named #{name.to_s}" do tokens_scanned_from(string).should match_tokens2(name) end end { "case" => :CASE, "class" => :CLASS, "default" => :DEFAULT, "define" => :DEFINE, # "import" => :IMPORT, # done as a function in egrammar "if" => :IF, "elsif" => :ELSIF, "else" => :ELSE, "inherits" => :INHERITS, "node" => :NODE, "and" => :AND, "or" => :OR, "undef" => :UNDEF, "false" => :BOOLEAN, "true" => :BOOLEAN, "in" => :IN, "unless" => :UNLESS, }.each do |string, name| it "should lex a keyword from '#{string}'" do tokens_scanned_from(string).should match_tokens2(name) end end # TODO: Complete with all edge cases [ 'A', 'A::B', '::A', '::A::B',].each do |string| it "should lex a CLASSREF on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:CLASSREF, string]) end end # TODO: Complete with all edge cases [ 'a', 'a::b', '::a', '::a::b',].each do |string| it "should lex a NAME on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NAME, string]) end end - [ 'a-b', 'a--b', 'a-b-c'].each do |string| + [ 'a-b', 'a--b', 'a-b-c', '_x'].each do |string| it "should lex a BARE WORD STRING on the form '#{string}'" do - tokens_scanned_from(string).should match_tokens2([:STRING, string]) + tokens_scanned_from(string).should match_tokens2([:WORD, string]) + end + end + + [ '_x::y', 'x::_y'].each do |string| + it "should consider the bare word '#{string}' to be a bad NAME" do + expect { + tokens_scanned_from(string) + }.to raise_error(/Illegal fully qualified name/) end end { '-a' => [:MINUS, :NAME], '--a' => [:MINUS, :MINUS, :NAME], 'a-' => [:NAME, :MINUS], 'a- b' => [:NAME, :MINUS, :NAME], 'a--' => [:NAME, :MINUS, :MINUS], 'a-$3' => [:NAME, :MINUS, :VARIABLE], }.each do |source, expected| it "should lex leading and trailing hyphens from #{source}" do tokens_scanned_from(source).should match_tokens2(*expected) end end { 'false'=>false, 'true'=>true}.each do |string, value| it "should lex a BOOLEAN on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:BOOLEAN, value]) end end [ '0', '1', '2982383139'].each do |string| it "should lex a decimal integer NUMBER on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NUMBER, string]) end end { ' 1' => '1', '1 ' => '1', ' 1 ' => '1'}.each do |string, value| it "should lex a NUMBER with surrounding space '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NUMBER, value]) end end [ '0.0', '0.1', '0.2982383139', '29823.235', '10e23', '10e-23', '1.234e23'].each do |string| it "should lex a decimal floating point NUMBER on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NUMBER, string]) end end [ '00', '01', '0123', '0777'].each do |string| it "should lex an octal integer NUMBER on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NUMBER, string]) end end [ '0x0', '0x1', '0xa', '0xA', '0xabcdef', '0xABCDEF'].each do |string| it "should lex an hex integer NUMBER on the form '#{string}'" do tokens_scanned_from(string).should match_tokens2([:NUMBER, string]) end end { "''" => '', "'a'" => 'a', "'a\\'b'" =>"a'b", "'a\\rb'" =>"a\\rb", "'a\\nb'" =>"a\\nb", "'a\\tb'" =>"a\\tb", "'a\\sb'" =>"a\\sb", "'a\\$b'" =>"a\\$b", "'a\\\"b'" =>"a\\\"b", "'a\\\\b'" =>"a\\b", "'a\\\\'" =>"a\\", }.each do |source, expected| it "should lex a single quoted STRING on the form #{source}" do tokens_scanned_from(source).should match_tokens2([:STRING, expected]) end end { '""' => '', '"a"' => 'a', '"a\'b"' => "a'b", }.each do |source, expected| it "should lex a double quoted STRING on the form #{source}" do tokens_scanned_from(source).should match_tokens2([:STRING, expected]) end end { '"a$x b"' => [[:DQPRE, 'a', {:line => 1, :pos=>1, :length=>2 }], [:VARIABLE, 'x', {:line => 1, :pos=>3, :length=>2 }], [:DQPOST, ' b', {:line => 1, :pos=>5, :length=>3 }]], '"a$x.b"' => [[:DQPRE, 'a', {:line => 1, :pos=>1, :length=>2 }], [:VARIABLE, 'x', {:line => 1, :pos=>3, :length=>2 }], [:DQPOST, '.b', {:line => 1, :pos=>5, :length=>3 }]], '"$x.b"' => [[:DQPRE, '', {:line => 1, :pos=>1, :length=>1 }], [:VARIABLE, 'x', {:line => 1, :pos=>2, :length=>2 }], [:DQPOST, '.b', {:line => 1, :pos=>4, :length=>3 }]], '"a$x"' => [[:DQPRE, 'a', {:line => 1, :pos=>1, :length=>2 }], [:VARIABLE, 'x', {:line => 1, :pos=>3, :length=>2 }], [:DQPOST, '', {:line => 1, :pos=>5, :length=>1 }]], }.each do |source, expected| it "should lex an interpolated variable 'x' from #{source}" do tokens_scanned_from(source).should match_tokens2(*expected) end end { '"$"' => '$', '"a$"' => 'a$', '"a$%b"' => "a$%b", '"a$$"' => "a$$", '"a$$%"' => "a$$%", }.each do |source, expected| it "should lex interpolation including false starts #{source}" do tokens_scanned_from(source).should match_tokens2([:STRING, expected]) end end it "differentiates between foo[x] and foo [x] (whitespace)" do tokens_scanned_from("$a[1]").should match_tokens2(:VARIABLE, :LBRACK, :NUMBER, :RBRACK) tokens_scanned_from("$a [1]").should match_tokens2(:VARIABLE, :LBRACK, :NUMBER, :RBRACK) tokens_scanned_from("a[1]").should match_tokens2(:NAME, :LBRACK, :NUMBER, :RBRACK) tokens_scanned_from("a [1]").should match_tokens2(:NAME, :LISTSTART, :NUMBER, :RBRACK) tokens_scanned_from(" if \n\r\t\nif if ").should match_tokens2(:IF, :IF, :IF) end it "skips whitepsace" do tokens_scanned_from(" if if if ").should match_tokens2(:IF, :IF, :IF) tokens_scanned_from(" if \n\r\t\nif if ").should match_tokens2(:IF, :IF, :IF) end it "skips single line comments" do tokens_scanned_from("if # comment\nif").should match_tokens2(:IF, :IF) end ["if /* comment */\nif", "if /* comment\n */\nif", "if /*\n comment\n */\nif", ].each do |source| it "skips multi line comments" do tokens_scanned_from(source).should match_tokens2(:IF, :IF) end end { "=~" => [:MATCH, "=~ /./"], "!~" => [:NOMATCH, "!~ /./"], "," => [:COMMA, ", /./"], "(" => [:LPAREN, "( /./"], "[" => [:LBRACK, "[ /./"], "{" => [:LBRACE, "{ /./"], "+" => [:PLUS, "+ /./"], "-" => [:MINUS, "- /./"], "*" => [:TIMES, "* /./"], ";" => [:SEMIC, "; /./"], }.each do |token, entry| it "should lex regexp after '#{token}'" do tokens_scanned_from(entry[1]).should match_tokens2(entry[0], :REGEX) end end it "should lex a simple expression" do tokens_scanned_from('1 + 1').should match_tokens2([:NUMBER, '1'], :PLUS, [:NUMBER, '1']) end { "1" => ["1 /./", [:NUMBER, :DIV, :DOT, :DIV]], "'a'" => ["'a' /./", [:STRING, :DIV, :DOT, :DIV]], "true" => ["true /./", [:BOOLEAN, :DIV, :DOT, :DIV]], "false" => ["false /./", [:BOOLEAN, :DIV, :DOT, :DIV]], "/./" => ["/./ /./", [:REGEX, :DIV, :DOT, :DIV]], "a" => ["a /./", [:NAME, :DIV, :DOT, :DIV]], "A" => ["A /./", [:CLASSREF, :DIV, :DOT, :DIV]], ")" => [") /./", [:RPAREN, :DIV, :DOT, :DIV]], "]" => ["] /./", [:RBRACK, :DIV, :DOT, :DIV]], "|>" => ["|> /./", [:RCOLLECT, :DIV, :DOT, :DIV]], "|>>" => ["|>> /./", [:RRCOLLECT, :DIV, :DOT, :DIV]], '"a$a"' => ['"a$a" /./', [:DQPRE, :VARIABLE, :DQPOST, :DIV, :DOT, :DIV]], }.each do |token, entry| it "should not lex regexp after '#{token}'" do tokens_scanned_from(entry[ 0 ]).should match_tokens2(*entry[ 1 ]) end end it 'should lex assignment' do tokens_scanned_from("$a = 10").should match_tokens2([:VARIABLE, "a"], :EQUALS, [:NUMBER, '10']) end # TODO: Tricky, and heredoc not supported yet # it "should not lex regexp after heredoc" do # tokens_scanned_from("1 / /./").should match_tokens2(:NUMBER, :DIV, :REGEX) # end it "should lex regexp at beginning of input" do tokens_scanned_from(" /./").should match_tokens2(:REGEX) end it "should lex regexp right of div" do tokens_scanned_from("1 / /./").should match_tokens2(:NUMBER, :DIV, :REGEX) end context 'when lexer lexes heredoc' do it 'lexes tag, syntax and escapes, margin and right trim' do code = <<-CODE @(END:syntax/t) Tex\\tt\\n |- END CODE tokens_scanned_from(code).should match_tokens2([:HEREDOC, 'syntax'], :SUBLOCATE, [:STRING, "Tex\tt\\n"]) end it 'lexes "tag", syntax and escapes, margin, right trim and interpolation' do code = <<-CODE @("END":syntax/t) Tex\\tt\\n$var After |- END CODE tokens_scanned_from(code).should match_tokens2( [:HEREDOC, 'syntax'], :SUBLOCATE, [:DQPRE, "Tex\tt\\n"], [:VARIABLE, "var"], [:DQPOST, " After"] ) end end it 'should support unicode characters' do code = <<-CODE "x\\u2713y" CODE if Puppet::Pops::Parser::Locator::RUBYVER < Puppet::Pops::Parser::Locator::RUBY_1_9_3 # Ruby 1.8.7 reports the multibyte char as several octal characters tokens_scanned_from(code).should match_tokens2([:STRING, "x\342\234\223y"]) else # >= Ruby 1.9.3 reports \u tokens_scanned_from(code).should match_tokens2([:STRING, "x\u2713y"]) end end context 'when lexing epp' do it 'epp can contain just text' do code = <<-CODE This is just text CODE epp_tokens_scanned_from(code).should match_tokens2(:EPP_START, [:RENDER_STRING, " This is just text\n"]) end it 'epp can contain text with interpolated rendered expressions' do code = <<-CODE This is <%= $x %> just text CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:RENDER_EXPR, nil], [:VARIABLE, "x"], [:EPP_END, "%>"], [:RENDER_STRING, " just text\n"] ) end it 'epp can contain text with trimmed interpolated rendered expressions' do code = <<-CODE This is <%= $x -%> just text CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:RENDER_EXPR, nil], [:VARIABLE, "x"], [:EPP_END_TRIM, "-%>"], [:RENDER_STRING, "just text\n"] ) end it 'epp can contain text with expressions that are not rendered' do code = <<-CODE This is <% $x=10 %> just text CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:VARIABLE, "x"], :EQUALS, [:NUMBER, "10"], [:RENDER_STRING, " just text\n"] ) end it 'epp can skip leading space in tail text' do code = <<-CODE This is <% $x=10 -%> just text CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:VARIABLE, "x"], :EQUALS, [:NUMBER, "10"], [:RENDER_STRING, "just text\n"] ) end it 'epp can skip comments' do code = <<-CODE This is <% $x=10 -%> <%# This is an epp comment -%> just text CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:VARIABLE, "x"], :EQUALS, [:NUMBER, "10"], [:RENDER_STRING, "just text\n"] ) end it 'epp can escape epp tags' do code = <<-CODE This is <% $x=10 -%> <%% this is escaped epp %%> CODE epp_tokens_scanned_from(code).should match_tokens2( :EPP_START, [:RENDER_STRING, " This is "], [:VARIABLE, "x"], :EQUALS, [:NUMBER, "10"], [:RENDER_STRING, "<% this is escaped epp %>\n"] ) end end end