1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 /* File: shapesparser.y
21 * Yacc input file to generate the parser for the Shapes language
26 /* Just like lex, the text within this first region delimited by %{ and %}
27 * is assumed to be C/C++ code and will be copied verbatim to the y.tab.c
28 * file ahead of the definitions of the yyparse() function. Add other header
29 * file inclusions or C++ variable declarations/prototypes that are needed
32 #include "shapestypes.h"
37 #include "astvalues.h"
39 #include "astidentifier.h"
41 #include "shapesexceptions.h"
43 #include "charptrless.h"
44 #include "autoonoff.h"
45 #include "shapescore.h"
46 #include "texlabelmanager.h"
48 using namespace Shapes;
50 extern YYLTYPE shapeslloc;
54 * Warning! Warning! Warning!
55 * We'll soon use that yylex was defined as
56 * #define yylex shapeslex
57 * in order to reset it after we're done with the inclusion.
61 #include "shapesscanner.h"
64 return Ast::theShapesScanner.yylex( );
66 #define yylex shapeslex
81 void shapeserror( RefCountPtr< const char > msg )
83 throw Exceptions::ParserError( shapeslloc, msg );
86 void shapeserror( char * msg )
88 shapeserror( strrefdup( msg ) );
95 * The section before the first %% is the Definitions section of the yacc
96 * input file. Here is where you declare tokens and types, add precedence
97 * and associativity options, and so on.
103 * Here we define the type of the yylval global variable that is used by
104 * the scanner to store attibute information about the token just scanned
105 * and thus communicate that information to the parser. You will need to
106 * add new fields to this union as you add different attributes to your
107 * non-terminal symbols.
111 Ast::Expression * expr;
113 Ast::MethodIdExpr * methodId;
114 std::list< Ast::Node * > * nodeList;
115 std::list< Ast::Expression * > * exprList;
116 std::list< RefCountPtr< const char > > * strList;
117 std::map< const char *, Ast::Expression *, charPtrLess > * namedExprMap;
118 Kernel::Formals * formals;
119 std::list< Kernel::Formals * > * formalsList;
120 Ast::ArgListExprs * argList;
121 Ast::SplitDefineVariables * splitFormals;
127 std::list< const Ast::CallExpr * > * callExprList;
128 std::list< Ast::ClassSection * > * classSectionList;
129 Ast::ClassSection * classSection;
130 Ast::MemberSection * memberSection;
131 Ast::MemberDeclaration * memberDeclaration;
132 Ast::StateReference * stateReference;
133 Ast::MemberMode memberMode;
134 Ast::ClassMode classMode;
135 Ast::FunctionMode functionMode;
141 * Here we tell yacc about all the token types that we are using.
142 * Yacc will assign unique numbers to these and export the #define
143 * in the generated y.tab.h header file.
146 %token <tokenID> T_EOF T_minusminus T_plusplus T_ddot T_dddot T_assign T_eqeq T_eqneq T_atat T_projection T_angle T_ampersandMore
147 %token <tokenID> T_cycle T_and T_or T_xor T_not T_mapsto T_emptybrackets T_dddotbrackets T_bangbrackets T_bangdddotbrackets T_compose T_surrounding T_lesseq T_greatereq T_llthan T_ggthan T_declaretype T_bangbang
148 %token <tokenID> T_tex T_dynamic T_continuation T_continue T_esc_continuation T_esc_continue
149 %token <tokenID> T_class T_members T_prepare T_abstract T_overrides T_gr__
150 %token <tokenID> T_split T_splitLeft T_splitRight T_unionLeft T_unionRight
151 // %token <tokenID> T_letdst T_plusassign T_minusassign T_starassign T_slashassign
153 %token <intVal> T_int
154 %token <floatVal> T_float T_length
155 %token <expr> T_speciallength
156 %token <boolVal> T_bool
157 %token <str> T_string T_identifier T_dynamic_identifier T_state_identifier T_dynamic_state_identifier T_typename
159 /* Non-terminal types
161 * In order for yacc to assign/access the correct field of $$, $1, we
162 * must to declare which field is appropriate for the non-terminal.
163 * As an example, this first type declaration establishes that the DeclList
164 * non-terminal uses the field named "declList" in the yylval union. This
165 * means that when we are setting $$ for a reduction for DeclList ore reading
166 * $n which corresponds to a DeclList nonterminal we are accessing the field
167 * of the union named "declList" which is of type List<Decl*>.
168 * pp2: You'll need to add many of these of your own.
171 %type <expr> Program Expr ExprExceptConstStrings DynamicBinding CallExpr CurryCallExpr MutateExpr Function OperatorFunction Class ConstantExceptStrings Coords PolarHandle
172 %type <expr> CodeBracket SuperCall SuperMemberReference
173 %type <exprList> InsertionSequence
174 %type <node> GroupElem
175 %type <nodeList> Group OneOrMoreGroupElems
176 %type <strList> OrderedFormals OneOrMoreOrderedFormals
177 %type <formals> Formals OneOrMoreFormalsItems
178 // %type <formalsList> NamedFormalsWithOrder OneOrMoreNamedFormalsWithOrder
179 %type <argList> ArgList OneOrMoreArgListItems
180 %type <methodId> MethodIdentifier
181 %type <callExprList> ListOfParentsWithInitargs;
182 %type <classSectionList> ClassSections OneOrMoreClassSections
183 %type <classSection> ClassSection
184 %type <memberSection> MemberDeclarations OneOrMoreMemberDeclarations
185 %type <memberSection> MethodDeclarations OneOrMoreMethodDeclarations
186 %type <memberDeclaration> MemberDeclaration MethodDeclaration
187 %type <memberMode> MemberAccessList MemberAccessSpecifier
188 %type <classMode> ClassModeList ClassModeSpecifier OneOrMoreClassModeSpecifiers
189 %type <functionMode> FunctionModeList OneOrMoreFunctionModeSpecifiers FunctionModeSpecifier
191 %type <stateReference> StateReference
192 %type <splitFormals> SplitFormals OneOrMoreSplitFormals
194 %nonassoc T_assign ':'
195 %left ']' T_splitRight
199 %right T_mapsto T_emptybrackets T_bangbrackets
200 %left T_dddotbrackets T_bangdddotbrackets
201 %left T_ampersandMore
203 %nonassoc T_dynamiccolon
207 %nonassoc T_eqeq T_eqneq
208 %left T_plusplus T_minusminus
210 %nonassoc T_lesseq T_greatereq
213 %left '*' '/' T_projection
216 %left '[' '.' T_splitLeft
219 %left T_atat T_surrounding
226 %name-prefix="shapes"
230 * All productions and actions should be placed between the start and stop
231 * %% markers which delimit the Rules section.
237 $$ = new Ast::CodeBracket( @1, $1 );
238 Ast::theProgram = $$;
243 shapeserror( "Expecting end of file." );
249 : '(' Expr ',' Expr ')'
251 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
252 args->orderedExprs_->push_back( $2 );
253 args->orderedExprs_->push_back( $4 );
254 $$ = new Ast::CallExpr( @$,
255 Ast::THE_FUNCTION_coords2D,
258 | '(' Expr ',' Expr '^' Expr ')'
260 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
261 args->orderedExprs_->push_back( $2 );
262 args->orderedExprs_->push_back( $4 );
263 args->orderedExprs_->push_back( $6 );
264 $$ = new Ast::CallExpr( @$,
265 Ast::THE_FUNCTION_cornercoords2D,
268 | '(' Expr ',' Expr '^' ')'
270 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
271 args->orderedExprs_->push_back( $2 );
272 args->orderedExprs_->push_back( $4 );
273 $$ = new Ast::CallExpr( @$,
274 Ast::THE_FUNCTION_cornercoords2D,
277 | '(' Expr ',' Expr ',' Expr ')'
279 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
280 args->orderedExprs_->push_back( $2 );
281 args->orderedExprs_->push_back( $4 );
282 args->orderedExprs_->push_back( $6 );
283 $$ = new Ast::CallExpr( @$,
284 Ast::THE_FUNCTION_coords3D,
291 : '(' Expr '^' Expr ')'
293 $$ = new Ast::PolarHandle2DExpr( @$, $2, $4 );
297 $$ = new Ast::PolarHandle2DExprFree_a( @$, $2 );
301 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
302 args->orderedExprs_->push_back( $3 );
303 $$ = new Ast::CallExpr( @$,
304 Ast::THE_FUNCTION_polarHandle2DFree_r,
309 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
310 $$ = new Ast::CallExpr( @$,
311 Ast::THE_FUNCTION_polarHandle2DFree_ra,
319 $$ = new Ast::LexiographicState( @1, $1, new Kernel::Environment::LexicalKey * ( 0 ) );
321 | T_dynamic_state_identifier
323 $$ = new Ast::DynamicState( @1, $1 );
330 $$ = new Ast::ArgListExprs( true );
332 | OneOrMoreArgListItems
335 OneOrMoreArgListItems
338 $$ = new Ast::ArgListExprs( true );
339 $$->orderedExprs_->push_back( $1 );
343 $$ = new Ast::ArgListExprs( true );
344 $$->orderedStates_->push_back( $1 );
346 | T_identifier ':' Expr
348 $$ = new Ast::ArgListExprs( true );
349 (*$$->namedExprs_)[ $1 ] = $3;
351 | T_state_identifier ':' StateReference
353 $$ = new Ast::ArgListExprs( true );
354 (*$$->namedStates_)[ $1 ] = $3;
356 | OneOrMoreArgListItems Expr
359 if( ! $$->namedExprs_->empty( ) )
361 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "Unnamed expressions may not appear among named expressions." ) ) );
363 $$->orderedExprs_->push_back( $2 );
365 | OneOrMoreArgListItems StateReference
368 if( ! $$->namedStates_->empty( ) )
370 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "Unnamed states may not appear among named states." ) ) );
372 $$->orderedStates_->push_back( $2 );
374 | OneOrMoreArgListItems T_identifier ':' Expr
377 if( $$->namedExprs_->find( $2 ) != $$->namedExprs_->end( ) )
379 Ast::theAnalysisErrorsList.push_back( new Exceptions::RepeatedFormal( @2, $2 ) );
381 (*$$->namedExprs_)[ $2 ] = $4;
383 | OneOrMoreArgListItems T_state_identifier ':' StateReference
386 if( $$->namedStates_->find( $2 ) != $$->namedStates_->end( ) )
388 Ast::theAnalysisErrorsList.push_back( new Exceptions::RepeatedFormal( @2, $2 ) );
390 (*$$->namedStates_)[ $2 ] = $4;
396 : '[' Expr ArgList ']'
398 $$ = new Ast::CallExpr( @$, $2, $3 );
400 | Expr T_emptybrackets Expr
402 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
403 args->orderedExprs_->push_back( $3 );
404 $$ = new Ast::CallExpr( @$,
408 | Expr T_emptybrackets Split
410 $$ = new Ast::CallSplitExpr( @$,
414 | Expr T_dddotbrackets Expr
416 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
417 args->orderedExprs_->push_back( $3 );
418 $$ = new Ast::CallExpr( @$,
421 true ); /* true means Curry */
423 | Expr T_dddotbrackets T_identifier ':' Expr %prec T_dynamiccolon
425 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
426 (*args->namedExprs_)[ $3 ] = $5;
427 $$ = new Ast::CallExpr( @$,
430 true ); /* true means Curry */
432 | Expr T_dddotbrackets Split
434 $$ = new Ast::CallSplitExpr( @$,
437 true ); /* true means Curry */
439 | '[' '!' Expr ArgList ']'
441 $$ = new Ast::CallExpr( @$, $3, $4, false, true ); /* false for no curry, true for procedural */
443 | Expr T_bangbrackets Expr
445 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
446 args->orderedExprs_->push_back( $3 );
447 $$ = new Ast::CallExpr( @$,
450 false, /* false means no curry */
451 true ); /* true means procedural */
453 | Expr T_bangbrackets Split
455 $$ = new Ast::CallSplitExpr( @$,
458 false, /* false means no curry */
459 true ); /* true means procedural */
461 | Expr T_bangdddotbrackets Expr
463 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
464 args->orderedExprs_->push_back( $3 );
465 $$ = new Ast::CallExpr( @$,
468 true, /* true means Curry */
469 true ); /* true means procedural */
471 | Expr T_bangdddotbrackets Split
473 $$ = new Ast::CallSplitExpr( @$,
476 true, /* false means no curry */
477 true ); /* true means procedural */
483 : '[' Expr ArgList T_dddot ']'
485 $$ = new Ast::CallExpr( @$, $2, $3, true ); /* true means Curry */
490 : StateReference '.' '[' T_identifier ArgList ']'
492 Ast::CallExpr * res =
493 new Ast::CallExpr( @$,
494 new Ast::MutatorReference( @4, $1, $4 ),
496 res->setMutatorSelf( $1 );
504 $$ = new Kernel::Formals( );
507 | T_split T_identifier
509 $$ = new Kernel::Formals( );
510 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $2, $$->defaultExprs_.size( ) ) );
511 /* Note that we do not push a default expression (not even a null pointer) for the sink.
512 * This way, the length of defaultExprs_ allways gives the number of non-sink arguments.
513 * The default value for the sink is taken care of in a non-standard way anyway.
518 | OneOrMoreFormalsItems
523 | OneOrMoreFormalsItems T_split T_identifier
526 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $3, $$->defaultExprs_.size( ) ) );
527 /* Note that we do not push a default expression (not even a null pointer) for the sink.
528 * This way, the length of defaultExprs_ allways gives the number of non-sink arguments.
529 * The default value for the sink is taken care of in a non-standard way anyway.
536 OneOrMoreFormalsItems
539 $$ = new Kernel::Formals( );
540 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $1, $$->defaultExprs_.size( ) ) );
541 $$->defaultExprs_.push_back( 0 );
543 | T_identifier ':' Expr
545 $$ = new Kernel::Formals( );
546 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $1, $$->defaultExprs_.size( ) ) );
547 $$->defaultExprs_.push_back( $3 );
551 $$ = new Kernel::Formals( );
552 $$->stateOrder_->insert( std::pair< const char *, size_t >( $1, $$->stateOrder_->size( ) ) );
554 | OneOrMoreFormalsItems T_identifier
557 if( $$->seenDefault_ )
559 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "Order-based formals may not appear among named formals." ) ) );
561 if( $$->argumentOrder_->find( $2 ) != $$->argumentOrder_->end( ) )
563 Ast::theAnalysisErrorsList.push_back( new Exceptions::RepeatedFormal( @2, $2 ) );
565 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $2, $$->defaultExprs_.size( ) ) );
566 $$->defaultExprs_.push_back( 0 );
568 | OneOrMoreFormalsItems T_identifier ':' Expr
571 $$->seenDefault_ = true;
572 if( $$->argumentOrder_->find( $2 ) != $$->argumentOrder_->end( ) )
574 Ast::theAnalysisErrorsList.push_back( new Exceptions::RepeatedFormal( @2, $2 ) );
576 $$->argumentOrder_->insert( std::pair< const char *, size_t >( $2, $$->defaultExprs_.size( ) ) );
577 $$->defaultExprs_.push_back( $4 );
579 | OneOrMoreFormalsItems T_state_identifier
582 if( $$->stateOrder_->find( $2 ) != $$->stateOrder_->end( ) )
584 Ast::theAnalysisErrorsList.push_back( new Exceptions::RepeatedFormal( @2, $2 ) );
586 $$->stateOrder_->insert( std::pair< const char *, size_t >( $2, $$->stateOrder_->size( ) ) );
594 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @$, strrefdup( "The list of split assignment variables must not be empty." ) ) );
595 $$ = new Ast::SplitDefineVariables( );
597 | T_split T_identifier
599 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @$, strrefdup( "Just a sink in a split assignment formals list makes no sense." ) ) );
600 $$ = new Ast::SplitDefineVariables( );
602 | OneOrMoreSplitFormals
606 | OneOrMoreSplitFormals T_split T_identifier
609 Ast::StructSplitSink * expr = new Ast::StructSplitSink( );
610 size_t ** pos = new size_t * ( 0 );
611 $$->sinkDefine_ = new Ast::DefineVariable( @3, $3, expr, pos );
612 $$->sinkExpr_ = expr;
616 OneOrMoreSplitFormals
619 $$ = new Ast::SplitDefineVariables( );
620 typedef typeof $$->exprs_ ListType;
621 size_t ** pos = new size_t * ( 0 );
622 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @1, static_cast< size_t >( 0 ), 0 );
623 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
626 | T_identifier ':' Expr
628 $$ = new Ast::SplitDefineVariables( );
629 typedef typeof $$->exprs_ ListType;
630 size_t ** pos = new size_t * ( 0 );
631 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @1, static_cast< size_t >( 0 ), $3 );
632 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
635 | T_identifier ':' '.' T_identifier
637 $$ = new Ast::SplitDefineVariables( );
638 typedef typeof $$->exprs_ ListType;
639 size_t ** pos = new size_t * ( 0 );
640 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @4, $4, 0 );
641 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
644 | T_identifier ':' '.' T_identifier ':' Expr
646 $$ = new Ast::SplitDefineVariables( );
647 typedef typeof $$->exprs_ ListType;
648 size_t ** pos = new size_t * ( 0 );
649 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @4, $4, $6 );
650 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
653 | T_identifier ':' '.' '\"'
655 $$ = new Ast::SplitDefineVariables( );
656 typedef typeof $$->exprs_ ListType;
657 size_t ** pos = new size_t * ( 0 );
658 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @4, strdup( $1 ), 0 );
659 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
662 | T_identifier ':' '.' '\"' ':' Expr
664 $$ = new Ast::SplitDefineVariables( );
665 typedef typeof $$->exprs_ ListType;
666 size_t ** pos = new size_t * ( 0 );
667 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @4, strdup( $1 ), $6 );
668 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @1, $1, ref, pos ),
671 | OneOrMoreSplitFormals T_identifier
676 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "Order-based formals may not appear among named formals." ) ) );
678 if( $$->seenDefault_ )
680 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "All order-based formals without default values must be placed before those with default values." ) ) );
682 typedef typeof $$->exprs_ ListType;
683 size_t ** pos = new size_t * ( 0 );
684 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @2, $$->exprs_.size( ), 0 );
685 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
688 | OneOrMoreSplitFormals T_identifier ':' Expr
693 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "Order-based formals may not appear among named formals." ) ) );
695 $$->seenDefault_ = true;
696 typedef typeof $$->exprs_ ListType;
697 size_t ** pos = new size_t * ( 0 );
698 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @2, $$->exprs_.size( ), $4 );
699 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
702 | OneOrMoreSplitFormals T_identifier ':' '.' T_identifier
705 $$->seenNamed_ = true;
706 typedef typeof $$->exprs_ ListType;
707 size_t ** pos = new size_t * ( 0 );
708 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @5, $5, 0 );
709 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
712 | OneOrMoreSplitFormals T_identifier ':' '.' T_identifier ':' Expr
715 $$->seenNamed_ = true;
716 typedef typeof $$->exprs_ ListType;
717 size_t ** pos = new size_t * ( 0 );
718 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @5, $5, $7 );
719 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
722 | OneOrMoreSplitFormals T_identifier ':' '.' '\"'
725 $$->seenNamed_ = true;
726 typedef typeof $$->exprs_ ListType;
727 size_t ** pos = new size_t * ( 0 );
728 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @5, strdup( $2 ), 0 );
729 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
732 | OneOrMoreSplitFormals T_identifier ':' '.' '\"' ':' Expr
735 $$->seenNamed_ = true;
736 typedef typeof $$->exprs_ ListType;
737 size_t ** pos = new size_t * ( 0 );
738 Ast::StructSplitReference * ref = new Ast::StructSplitReference( @5, strdup( $2 ), $7 );
739 $$->exprs_.push_back( ListType::value_type( new Ast::DefineVariable( @2, $2, ref, pos ),
746 : '\\' Formals T_mapsto FunctionModeList Expr
748 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
749 Ast::FunctionFunction * res = new Ast::FunctionFunction( @$, $2, $5, $4 );
750 res->push_exprs( args );
751 $$ = new Ast::CallExpr( @$,
752 RefCountPtr< const Lang::Function >( res ),
755 | '(' OperatorFunction ')'
764 $$ = new list< RefCountPtr< const char > >( );
766 | OneOrMoreOrderedFormals
769 OneOrMoreOrderedFormals
772 $$ = new list< RefCountPtr< const char > >( );
773 $$->push_back( strrefdup( $1 ) );
775 | OneOrMoreOrderedFormals T_identifier
778 $$->push_back( strrefdup( $2 ) );
785 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_MINUSMINUS ) );
789 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_PLUSPLUS ) );
793 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_AMPERSAND ) );
797 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_PLUS ) );
801 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_MINUS ) );
805 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_STAR ) );
809 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_SLASH ) );
813 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_PROJECTION ) );
817 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_ANGLE ) );
821 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_AMPERSAND_MORE ) );
825 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_NEG ) );
829 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_COMPOSE ) );
833 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_LESS ) );
837 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_GREATER ) );
841 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_EQEQ ) );
845 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_EQNEQ ) );
849 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_LESSEQ ) );
853 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_GREATEREQ ) );
857 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_NOT ) );
861 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_FUNCTION_AND ) );
865 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_FUNCTION_OR ) );
869 $$ = new Ast::Constant( @$, static_cast< RefCountPtr< const Lang::Value > >( Lang::THE_OPERATOR_XOR ) );
874 : ExprExceptConstStrings
877 $$ = new Ast::Constant( @1, new Lang::String( $1, false ) );
881 ExprExceptConstStrings
882 : ConstantExceptStrings
885 | '(' T_tex ExprExceptConstStrings ')'
887 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
888 args->orderedExprs_->push_back( $3 );
889 $$ = new Ast::CallExpr( @$,
890 Ast::THE_FUNCTION_TeX,
893 | '(' T_tex T_string ')'
895 Kernel::theTeXLabelManager.announce( string( $3 ), @3 );
896 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
897 args->orderedExprs_->push_back( new Ast::Constant( @3, new Lang::String( $3, false ) ) );
898 $$ = new Ast::CallExpr( @$,
899 Ast::THE_FUNCTION_TeX,
905 $$->immediate_ = true;
910 | SuperMemberReference
918 $$ = new Ast::NegExpr( @$, @2, $3 );
922 $$ = new Ast::RelativeExpr( @$, @2, $3 );
926 $$ = new Ast::EmptyExpression( @$ );
928 | '(' Expr T_llthan InsertionSequence ')'
930 std::list< Ast::Node * > * bracket = new std::list< Ast::Node * >( );
932 size_t ** pos = new size_t * ( 0 );
933 Ast::StateReference * dst = new Ast::LexiographicState( @2, strdup( Kernel::SEQUENTIAL_EXPR_VAR_ID ), new Kernel::Environment::LexicalKey * ( 0 ) );
935 bracket->push_back( new Ast::IntroduceState( @3,
936 strdup( Kernel::SEQUENTIAL_EXPR_VAR_ID ),
939 for( std::list< Ast::Expression * >::const_iterator i = $4->begin( ); i != $4->end( ); ++i )
941 bracket->push_back( new Ast::Insertion( dst, *i ) );
943 bracket->push_back( new Ast::Freeze( @3, strdup( Kernel::SEQUENTIAL_EXPR_VAR_ID ), pos ) );
944 $$ = new Ast::CodeBracket( @$, bracket );
948 $$ = new Ast::EvalOutsideExpr( @$, $2 );
955 Kernel::Environment::LexicalKey ** key = new Kernel::Environment::LexicalKey * ( 0 );
956 $$ = new Ast::LexiographicVariable( @$, $1, key );
960 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
961 Ast::EvalSymbolFunction * res = new Ast::EvalSymbolFunction( @$, $2 );
962 res->push_exprs( args );
963 $$ = new Ast::CallExpr( @$,
964 RefCountPtr< const Lang::Function >( res ),
967 | T_dynamic_identifier
969 $$ = new Ast::DynamicVariable( @$, $1 );
971 | '(' StateReference ')'
973 $$ = new Ast::Peek( @$, $2 );
976 | Expr '.' T_identifier
978 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
979 Ast::MemberReferenceFunction * res = new Ast::MemberReferenceFunction( @$, $1, $3 );
980 res->push_exprs( args );
981 $$ = new Ast::CallExpr( @$,
982 RefCountPtr< const Lang::Function >( res ),
985 | Expr '.' MethodIdentifier
987 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
988 Ast::PublicMethodReferenceFunction * res = new Ast::PublicMethodReferenceFunction( @$, $1, $3 );
989 res->push_exprs( args );
990 $$ = new Ast::CallExpr( @$,
991 RefCountPtr< const Lang::Function >( res ),
995 | '(' T_esc_continuation T_identifier Expr ')'
997 $$ = new Ast::LetDynamicECExpr( @$, @3, $3, $4 );
999 | '(' T_esc_continue T_identifier Expr ')'
1001 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1002 Ast::ContinueDynamicECFunction * res = new Ast::ContinueDynamicECFunction( @3, $3, $4 );
1003 res->push_exprs( args );
1004 $$ = new Ast::CallExpr( @$,
1005 RefCountPtr< const Lang::Function >( res ),
1007 /* This used to be immediate, but right now that seems utterly wrong!
1008 * Imagine choosing between two continuations; then both continuations would require invokation before being "passed" to the <if> function.
1009 * On the other hand, I can admit that it seems a bit uncanny to let the <if> function return the continuation invokations as thunks, not
1010 * knowing when they will be forced... But I don't think there's a choice here anyway; this expression can't be immediate.
1015 $$ = new Ast::WithDynamicExpr( @$, $1, $3 );
1017 | T_unionLeft ArgList T_unionRight
1019 $$ = new Ast::UnionExpr( @$, $2 );
1021 | Expr T_minusminus T_cycle
1023 $$ = new Ast::CycleExpr( @3, $1 );
1025 | Expr T_minusminus Expr
1027 $$ = new Ast::MinusMinusExpr( @2, $1, $3 );
1029 | Expr T_plusplus Expr
1031 $$ = new Ast::PlusPlusExpr( @2, $1, $3 );
1035 $$ = new Ast::AmpersandExpr( @2, $1, $3 );
1039 $$ = new Ast::PlusExpr( @2, $1, $3 );
1043 $$ = new Ast::MinusExpr( @2, $1, $3 );
1047 $$ = new Ast::AngleExpr( @2, $1, $3 );
1049 | Expr T_ampersandMore Expr
1051 $$ = new Ast::AmpersandMoreExpr( @2, $1, $3 );
1055 $$ = new Ast::StarExpr( @2, $1, $3 );
1057 | Expr T_projection Expr
1059 $$ = new Ast::ProjectionExpr( @2, $1, $3 );
1063 $$ = new Ast::SlashExpr( @2, $1, $3 );
1067 $$ = new Ast::NegExpr( @1, $2 );
1069 | Expr T_compose Expr
1071 $$ = new Ast::ComposeExpr( @2, $1, $3 );
1075 $$ = new Ast::LessExpr( @2, $1, $3 );
1079 $$ = new Ast::GreaterExpr( @2, $1, $3 );
1083 $$ = new Ast::EqualExpr( @2, $1, $3 );
1087 $$ = new Ast::NotEqualExpr( @2, $1, $3 );
1089 | Expr T_lesseq Expr
1091 $$ = new Ast::LessEqualExpr( @2, $1, $3 );
1093 | Expr T_greatereq Expr
1095 $$ = new Ast::GreaterEqualExpr( @2, $1, $3 );
1099 $$ = new Ast::NotExpr( @1, $2 );
1103 // $$ = new Ast::AndExpr( @2, $1, $3 );
1105 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
1106 args->orderedExprs_->push_back( $1 );
1107 args->orderedExprs_->push_back( $3 );
1108 $$ = new Ast::CallExpr( @$,
1109 Lang::THE_FUNCTION_AND,
1114 // $$ = new Ast::OrExpr( @2, $1, $3 );
1116 Ast::ArgListExprs * args = new Ast::ArgListExprs( true );
1117 args->orderedExprs_->push_back( $1 );
1118 args->orderedExprs_->push_back( $3 );
1119 $$ = new Ast::CallExpr( @$,
1120 Lang::THE_FUNCTION_OR,
1125 $$ = new Ast::XorExpr( @2, $1, $3 );
1129 Kernel::Environment::LexicalKey ** key = new Kernel::Environment::LexicalKey * ( 0 );
1130 $$ = new Ast::LexiographicType( @$, $1, key );
1136 : T_dynamic_identifier ':' Expr %prec T_dynamiccolon
1138 $$ = new Ast::DynamicBindingExpression( @$, $1, $3, new Kernel::Environment::LexicalKey * ( 0 ) );
1140 | T_dynamic_identifier ':' T_dynamic Expr %prec T_dynamiccolon
1142 $$ = new Ast::DynamicBindingExpression( @$, $1,
1143 new Ast::DynamicExpression( @4, $4 ),
1144 new Kernel::Environment::LexicalKey * ( 0 ) );
1146 | T_dynamic_state_identifier ':' StateReference %prec T_dynamiccolon
1148 $$ = new Ast::DynamicStateBindingExpression( @$, @1, $1, $3 );
1153 ConstantExceptStrings
1156 $$ = new Ast::Constant( @1, new Lang::Integer( $1 ) );
1160 $$ = new Ast::Constant( @1, new Lang::Float( $1 ) );
1164 $$ = new Ast::Constant( @1, new Lang::Length( $1 ) );
1168 $$ = new Ast::Constant( @1, new Lang::Boolean( $1 ) );
1172 $$ = new Ast::Constant( @1, new Lang::Symbol( $2 ) );
1179 $$ = new Ast::CodeBracket( @$, $2 );
1186 $$ = $1; // Explicit upcast avoids bison warning.
1188 | T_identifier ':' Expr
1190 size_t ** pos = new size_t * ( 0 );
1191 $$ = new Ast::DefineVariable( @1, $1, $3, pos );
1193 | T_state_identifier ':' Expr
1195 size_t ** pos = new size_t * ( 0 );
1196 $$ = new Ast::IntroduceState( @1, $1, $3, pos );
1198 | T_state_identifier ';'
1200 size_t ** pos = new size_t * ( 0 );
1201 $$ = new Ast::Freeze( @1, $1, pos );
1203 | T_identifier ':' T_state_identifier ';'
1205 size_t ** posVar = new size_t * ( 0 );
1206 size_t ** posState = new size_t * ( 0 );
1207 $$ = new Ast::DefineVariable( @1, $1, new Ast::Freeze( @3, $3, posState ), posVar );
1209 | T_dynamic T_dynamic_identifier Expr Expr
1211 $$ = new Ast::DynamicVariableDecl( @$, @2, $2, $3, $4 );
1213 | T_dynamic T_dynamic_identifier Expr T_dynamic Expr
1215 $$ = new Ast::DynamicVariableDecl( @$, @2, $2, $3,
1216 new Ast::DynamicExpression( @5, $5 ) );
1218 | T_dynamic T_dynamic_state_identifier StateReference
1220 $$ = new Ast::DynamicStateDecl( @$, @2, $2, $3, new size_t * ( 0 ) );
1222 | Expr '.' T_identifier T_llthan InsertionSequence
1224 shapeserror( "MemberInsertionSequence not implemented" );
1225 // $$ = new Ast::MemberInsertionSequence( @$, $1, $3, $5 );
1227 | '(' '#' Expr ')' '.' T_identifier T_llthan InsertionSequence
1229 shapeserror( "ProtectedMemberInsertionSequence not implemented" );
1230 // $$ = new Ast::ProtectedMemberInsertionSequence( @$, @2, $3, $6, $8 );
1237 $$ = new std::list< Ast::Expression * >( );
1238 $$->push_back( $1 );
1240 | InsertionSequence T_llthan Expr
1243 $$->push_back( $3 );
1250 $$ = new list< Ast::Node * >( );
1251 $$->push_back( $1 );
1253 | OneOrMoreGroupElems GroupElem
1256 $$->push_back( $2 );
1258 | StateReference T_llthan InsertionSequence
1260 $$ = new list< Ast::Node * >( );
1261 for( std::list< Ast::Expression * >::const_iterator i = $3->begin( ); i != $3->end( ); ++i )
1263 $$->push_back( new Ast::Insertion( $1, *i ) );
1266 | OneOrMoreGroupElems StateReference T_llthan InsertionSequence
1269 for( std::list< Ast::Expression * >::const_iterator i = $4->begin( ); i != $4->end( ); ++i )
1271 $$->push_back( new Ast::Insertion( $2, *i ) );
1274 | T_splitLeft SplitFormals T_splitRight ':' Expr
1276 $$ = new list< Ast::Node * >( );
1277 size_t ** pos = new size_t * ( 0 );
1279 $5->immediate_ = true;
1280 $$->push_back( new Ast::DefineVariable( @5, $2->newSplitVarId( ), $5, pos ) );
1282 size_t orderedCount = 0;
1284 typedef typeof $2->exprs_ ListType;
1285 for( ListType::iterator i = $2->exprs_.begin( ); i != $2->exprs_.end( ); ++i )
1287 i->second->setStruct( @5, pos );
1288 $$->push_back( i->first );
1289 if( i->second->isOrdered( ) )
1295 if( $2->sinkDefine_ != 0 )
1297 $2->sinkExpr_->setStruct( @5, pos, orderedCount );
1298 $$->push_back( $2->sinkDefine_ );
1302 $$->push_back( new Ast::AssertNoSinkNeeded( @2, orderedCount, @5, pos ) );
1305 | T_splitLeft SplitFormals T_splitRight Expr
1307 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @4, strrefdup( "Expected ':'." ) ) );
1308 $$ = new list< Ast::Node * >( );
1309 $$->push_back( new Ast::ErrorExpression( @$ ) );
1311 | OneOrMoreGroupElems T_splitLeft SplitFormals T_splitRight ':' Expr
1314 size_t ** pos = new size_t * ( 0 );
1316 $6->immediate_ = true;
1317 $$->push_back( new Ast::DefineVariable( @6, $3->newSplitVarId( ), $6, pos ) );
1319 size_t orderedCount = 0;
1321 typedef typeof $3->exprs_ ListType;
1322 for( ListType::iterator i = $3->exprs_.begin( ); i != $3->exprs_.end( ); ++i )
1324 i->second->setStruct( @6, pos );
1325 $$->push_back( i->first );
1326 if( i->second->isOrdered( ) )
1332 if( $3->sinkDefine_ != 0 )
1334 $3->sinkExpr_->setStruct( @6, pos, orderedCount );
1335 $$->push_back( $3->sinkDefine_ );
1339 $$->push_back( new Ast::AssertNoSinkNeeded( @3, orderedCount, @6, pos ) );
1342 | OneOrMoreGroupElems T_splitLeft SplitFormals T_splitRight Expr
1344 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @4, strrefdup( "Expected ':'." ) ) );
1346 $$->push_back( new Ast::ErrorExpression( @$ ) );
1353 $$ = new list< Ast::Node * >( );
1355 | OneOrMoreGroupElems
1359 SuperMemberReference
1360 : '(' '#' Expr ')' '.' T_identifier
1362 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1363 Ast::ProtectedMemberReferenceFunction * res = new Ast::ProtectedMemberReferenceFunction( @$, @2, $3, @6, $6 );
1364 res->push_exprs( args );
1365 $$ = new Ast::CallExpr( @$,
1366 RefCountPtr< const Lang::Function >( res ),
1373 : T_identifier '#' T_identifier
1375 Kernel::Environment::LexicalKey ** key = new Kernel::Environment::LexicalKey * ( 0 );
1376 $$ = new Ast::MethodIdExpr( @$, new Ast::LexiographicVariable( @1, $1, key ), $3 );
1382 : '[' '(' '#' Expr ')' '.' MethodIdentifier ArgList ']'
1384 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1385 Ast::ProtectedMethodReferenceFunction * res = new Ast::ProtectedMethodReferenceFunction( @$, @3, $4, $7 );
1386 res->push_exprs( args );
1387 $$ = new Ast::CallExpr( @$,
1388 new Ast::CallExpr( @3,
1389 RefCountPtr< const Lang::Function >( res ),
1393 | '[' '(' '#' ')' '.' MethodIdentifier ArgList ']'
1395 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1396 Ast::ProtectedMethodReferenceFunction * res = new Ast::ProtectedMethodReferenceFunction( @$, @3, 0, $6 );
1397 res->push_exprs( args );
1398 $$ = new Ast::CallExpr( @$,
1399 new Ast::CallExpr( @3,
1400 RefCountPtr< const Lang::Function >( res ),
1408 : '[' T_class '(' Expr Formals ')' T_identifier '(' ListOfParentsWithInitargs ')'
1413 DeleteOnExit< char > isaDeleter( $7 );
1414 if( strcmp( $7, "isa" ) != 0 )
1416 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @7, strrefdup( "Expected \"isa\"." ) ) );
1418 if( ( $11 & Ast::CLASS_MODE_ABSTRACT ) != 0 && ( $11 & Ast::CLASS_MODE_FINAL ) != 0 )
1420 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @11, strrefdup( "Declaring a class both abstract and final is forbidden." ) ) );
1423 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1424 Ast::ClassFunction * res = new Ast::ClassFunction( @$, $4, $5, $9, $11, $12 );
1425 res->push_exprs( args );
1426 $$ = new Ast::CallExpr( @$,
1427 RefCountPtr< const Lang::Function >( res ),
1432 ListOfParentsWithInitargs
1433 : '(' Expr ArgList ')'
1435 $$ = new std::list< const Ast::CallExpr * >;
1436 $$->push_back( new Ast::CallExpr( @$, $2, $3 ) );
1438 | ListOfParentsWithInitargs '(' Expr ArgList ')'
1441 $$->push_back( new Ast::CallExpr( Ast::SourceLocation( @2, @5 ), $3, $4 ) );
1450 | OneOrMoreClassModeSpecifiers
1453 OneOrMoreClassModeSpecifiers
1454 : ClassModeSpecifier
1455 | OneOrMoreClassModeSpecifiers ClassModeSpecifier
1464 DeleteOnExit< char > strDeleter( $1 );
1466 if( strcmp( $1, "abstract" ) == 0 )
1468 $$ = Ast::CLASS_MODE_ABSTRACT;
1470 else if( strcmp( $1, "final" ) == 0 )
1472 $$ = Ast::CLASS_MODE_FINAL;
1476 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @$, strrefdup( "This is not a valid class mode specifier" ) ) );
1484 $$ = new std::list< Ast::ClassSection * >;
1486 | OneOrMoreClassSections
1489 OneOrMoreClassSections
1492 $$ = new std::list< Ast::ClassSection * >;
1493 $$->push_back( $1 );
1495 | OneOrMoreClassSections ClassSection
1498 $$->push_back( $2 );
1503 : '(' T_members MemberDeclarations ')'
1507 | '(' T_prepare Group ')'
1509 $$ = new Ast::PrepareSection( @$, $3 );
1511 | '(' T_identifier MethodDeclarations ')'
1513 DeleteOnExit< char > accessSpecDeleter( $2 );
1514 unsigned int accessSpec = 0;
1515 if( strcmp( $2, "__methods__" ) == 0 )
1517 accessSpec = Ast::MEMBER_ACCESS_PUBLIC_GET | Ast::MEMBER_ACCESS_PROTECTED_GET;
1519 else if( strcmp( $2, "__abstract__" ) == 0 )
1521 accessSpec = Ast::MEMBER_ACCESS_PUBLIC_GET | Ast::MEMBER_ACCESS_PROTECTED_GET | Ast::MEMBER_ABSTRACT;
1523 else if( strcmp( $2, "__final__" ) == 0 )
1525 accessSpec = Ast::MEMBER_ACCESS_PUBLIC_GET | Ast::MEMBER_ACCESS_PROTECTED_GET | Ast::MEMBER_FINAL;
1527 else if( strcmp( $2, "__protected__" ) == 0 )
1529 accessSpec = Ast::MEMBER_ACCESS_PROTECTED_GET;
1531 else if( strcmp( $2, "__private__" ) == 0 )
1537 Ast::theAnalysisErrorsList.push_back( new Exceptions::ParserError( @2, strrefdup( "This is not a valid method access specifier." ) ) );
1539 $3->addModeBits( accessSpec );
1542 | '(' T_abstract OrderedFormals ')'
1544 $$ = new Ast::AbstractSection( @$, $3 );
1546 | '(' T_overrides Expr T_gr__ MethodDeclarations ')'
1548 $$ = new Ast::OverridesSection( $3, $5 );
1555 $$ = new Ast::MemberSection;
1557 | OneOrMoreMemberDeclarations
1560 OneOrMoreMemberDeclarations
1563 $$ = new Ast::MemberSection;
1564 $$->push_back( $1 );
1566 | OneOrMoreMemberDeclarations MemberDeclaration
1569 $$->push_back( $2 );
1574 : '(' T_identifier Expr ')'
1576 $$ = new Ast::MemberDeclaration( @$, $2, $3, 0 );
1578 | '(' T_identifier Expr MemberAccessList ')'
1580 $$ = new Ast::MemberDeclaration( @$, $2, $3, $4 );
1585 : MemberAccessSpecifier
1586 | MemberAccessList MemberAccessSpecifier
1592 MemberAccessSpecifier
1595 $$ = Ast::MEMBER_ACCESS_PUBLIC_GET | Ast::MEMBER_ACCESS_PROTECTED_GET;
1599 $$ = Ast::MEMBER_ACCESS_PUBLIC_GET | Ast::MEMBER_ACCESS_PUBLIC_INSERT | Ast::MEMBER_ACCESS_PROTECTED_GET | Ast::MEMBER_ACCESS_PROTECTED_INSERT;
1603 $$ = Ast::MEMBER_ACCESS_PROTECTED_GET;
1605 | '(' '#' T_llthan ')'
1607 $$ = Ast::MEMBER_ACCESS_PROTECTED_GET | Ast::MEMBER_ACCESS_PROTECTED_INSERT;
1611 $$ = Ast::MEMBER_TRANSFORMING;
1618 $$ = new Ast::MemberSection;
1620 | OneOrMoreMethodDeclarations
1623 OneOrMoreMethodDeclarations
1626 $$ = new Ast::MemberSection;
1627 $$->push_back( $1 );
1629 | OneOrMoreMethodDeclarations MethodDeclaration
1632 $$->push_back( $2 );
1637 : '(' T_identifier Expr ')'
1639 $$ = new Ast::MemberDeclaration( @$, $2, $3, Ast::MEMBER_CONST | Ast::MEMBER_METHOD );
1641 | '(' '[' T_identifier Formals ']' FunctionModeList GroupElem ')'
1643 Ast::Expression * body = dynamic_cast< Ast::Expression * >( $7 );
1646 std::list< Ast::Node * > * bracket = new std::list< Ast::Node * >( );
1647 bracket->push_back( $7 );
1648 body = new Ast::CodeBracket( @7, bracket );
1650 Ast::ArgListExprs * args = new Ast::ArgListExprs( false );
1651 Ast::FunctionFunction * res = new Ast::FunctionFunction( @$, $4, body, $6 );
1652 res->push_exprs( args );
1653 $$ = new Ast::MemberDeclaration( @$, $3, new Ast::CallExpr( @$,
1654 RefCountPtr< const Lang::Function >( res ),
1656 Ast::MEMBER_CONST | Ast::MEMBER_METHOD | ( (($6 & Ast::FUNCTION_TRANSFORMING) != 0) ? Ast::MEMBER_TRANSFORMING : 0 ) );
1665 | OneOrMoreFunctionModeSpecifiers
1668 OneOrMoreFunctionModeSpecifiers
1669 : FunctionModeSpecifier
1670 | OneOrMoreFunctionModeSpecifiers FunctionModeSpecifier
1676 FunctionModeSpecifier
1679 $$ = Ast::FUNCTION_TRANSFORMING;
1683 $$ = Ast::FUNCTION_PROCEDURAL;
1696 /* The closing %% above marks the end of the Rules section and the beginning
1697 * of the User Subroutines section. All text from here to the end of the
1698 * file is copied verbatim to the end of the generated y.tab.c file.
1699 * This section is where you put definitions of helper functions.