Ignore:
Timestamp:
12/05/09 14:23:12 (15 years ago)
Author:
nasko
Message:

Work in progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xtext-MDT/org.modelica.xtext.core/src/org/modelica/xtext/ModelicaAST.xtext

    r550 r552  
    133133    |{ClassPart::PROTECTED} 'protected' (contents+=ElementItem)*
    134134    |{ClassPart::EQUATIONS} 'equation' (contents+=EquationItem)*
    135     |{ClassPart::INITIALEQUATIONS} 'initial' 'equation' (contents+=EquationItem)*
     135    //|{ClassPart::INITIALEQUATIONS} 'initial' 'equation' (contents+=EquationItem)*
    136136    |{ClassPart::ALGORITHMS} 'algorithm' (contents+=AlgorithmItem)*
    137137    |{ClassPart::INITIALALGORITHMS} 'initial' 'algorithm' (contents+=AlgorithmItem)*
     
    167167    | (redeclareKeywords=RedeclareReplaceableKeyword | redeclareKeywords=ReplaceableKeyword) innerOuter=InnerOuter
    168168        (specification=ElementSpecificationClassDefinition | specification=ElementSpecificationComponents) 
    169     ;
    170 
    171 //('constrainedby' name=IDENT  constrainClass=ConstrainClass)?
     169    constrainClass=ConstrainClass?
     170    ;
     171
     172ConstrainClass returns ConstrainClass::uConstrainClass :
     173    {ConstrainClass::CONSTRAINCLASS} elementSpec=ElementSpecificationConstrainedby comment=Comment?
     174    ;
     175
    172176/*
    173 ConstrainClass returns uConstrainClass :
    174     {CONSTRAINCLASS} elementSpec=ElementSpecification comment=Comment
    175     ;
    176 */
    177 
    178 
    179177ElementSpecification returns ElementSpec::uElementSpec :
    180178    ElementSpecificationImport
     
    183181    |ElementSpecificationComponents
    184182    ;
    185 
     183*/
    186184ElementSpecificationImport returns ElementSpec::uElementSpec :
    187185    {ElementSpec::IMPORT} 'import' import_=Import comment=Comment
     
    193191    ;
    194192
    195 /* FIXME check the 'replaceable' */
     193ElementSpecificationConstrainedby returns ElementSpec::uElementSpec :
     194    {ElementSpec::EXTENDS} 'constrainedby' path=Path ( '('
     195    elementArg+=ElementArg (',' elementArg+=ElementArg)* ')' )? annotationOpt=Annotation?
     196    ;
     197
     198/* FIXME 'replaceable' both here and in InnerClass */
    196199ElementSpecificationClassDefinition returns ElementSpec::uElementSpec :
    197200    {ElementSpec::CLASSDEF} /*replaceable_?=('replaceable')?*/ class_=InnerClass
     
    245248Equation returns Equation::uEquation :
    246249    EquationIf | EquationEquals | EquationConnect | EquationFor | EquationWhenEq
    247     | EquationNoRetCall  //FIXME what is this doing?
     250    | EquationNoRetCall
    248251    //|EqFailure
    249252    ;
     
    309312    ;
    310313
    311 AlgorithmFor returns AlgorithmStatement::ALG_FOR :
    312     'for' iterators=ForIterators 'loop' (forBody+=AlgorithmItem)* 'end' 'for'
     314AlgorithmFor returns AlgorithmStatement::uAlgorithmStatement :
     315    {AlgorithmStatement::ALG_FOR} 'for' iterators=ForIterators 'loop' (forBody+=AlgorithmItem)* 'end' 'for'
    313316    ;
    314317
     
    341344    ;
    342345   
    343 // TODO componentRef? constrain part
    344346ElementArg returns ElementArg::uElementArg :
    345347    {ElementArg::MODIFICATION} each_=Each finalItem?=('final')?
     
    349351    redeclareKeywords=( ReplaceableKeyword | RedeclareReplaceableKeyword )
    350352    elementSpec=( ElementSpecificationClassDefinition | ElementSpecificationComponents1 )
    351     /* constrainClass=ConstrainClass? */
     353    constrainClass=ConstrainClass?
    352354    |{ElementArg::REDECLARATION} each_=Each finalItem?=('final') redeclareKeywords=RedeclareKeyword
    353355    elementSpec=( ElementSpecificationClassDefinition | ElementSpecificationComponents1 )
     
    414416
    415417ExprRange returns Exp::uExp :
    416     ExprLogical ({Exp::RANGE.start=current} ':' step=ExprLogical (':' stop=ExprLogical)? )?
     418    ExprLogical ({Exp::RANGE.start=current} ':'  stop=ExprLogical
     419    | {Exp::RANGE.start=current} ':' step=ExprLogical ':' stop=ExprLogical )?
    417420    ;
    418421   
     
    432435ExprRelation returns Exp::uExp :
    433436    ExprArithmetic
    434     ({Exp::RELATION.exp1=current}  op=( OperatorLess | OperatorLessEq | OperatorGreater | OperatorGreaterEq
    435         | OperatorEqual | OperatorNotEqual ) exp2=ExprArithmetic)?
     437    ({Exp::RELATION.exp1=current}  op=OperatorLogical exp2=ExprArithmetic)?
    436438    ;
    437439
    438440ExprArithmetic returns Exp::uExp :
    439441    ExprUnaryArithmetic
    440     ({Exp::BINARY.exp1=current} op=(OperatorAdd | OperatorSub | OperatorAddEW | OperatorSubEW) exp2=ExprArithmetic2)?
     442    ({Exp::BINARY.exp1=current} op=OperatorAddSub exp2=ExprArithmetic2)?
    441443    ;
    442444
    443445ExprArithmetic2 returns Exp::uExp :
    444446    ExprArithmeticTerm
    445     ({Exp::BINARY.exp1=current} op=(OperatorAdd | OperatorSub | OperatorAddEW | OperatorSubEW) exp2=ExprArithmetic2)?
     447    ({Exp::BINARY.exp1=current} op=OperatorAddSub exp2=ExprArithmetic2)?
    446448    ;
    447449
     
    483485
    484486ExprComponentRef returns Exp::uExp :
    485     {Exp::CREF} componentReg=ComponentRef
     487    {Exp::CREF} componentRef=ComponentRef
    486488    ;
    487489
     
    548550    Operators
    549551*/
     552
     553OperatorLogical returns Operator::uOperator:
     554    {Operator::LESS} '<' | {Operator::LESSEQ} '<=' | {Operator::GREATER} '>'
     555    | {Operator::GREATEREQ} '>=' | {Operator::EQUAL} '==' | {Operator::NEQUAL} ('><'|'!=')
     556    ;
     557
     558OperatorAddSub returns Operator::uOperator:
     559    {Operator::ADD} '+' | {Operator::SUB} '-' | {Operator::ADD_EW} '.+' | {Operator::SUB_EW} '.-'
     560    ;
     561
    550562   
    551563OperatorAdd returns Operator::ADD :
     
    620632    {Operator::LESS} '<'
    621633    ;
    622    
     634
    623635OperatorLessEq returns Operator::LESSEQ :
    624636    {Operator::LESSEQ} '<='
     
    647659    ComponentReferenceQualified
    648660    |{ComponentRef::CREF_IDENT}
    649     name=IDENT ('[' subscripts+=Subscript (',' subscripts+=Subscript)* ']')?
     661    ref=IDENT ('[' subscripts+=Subscript (',' subscripts+=Subscript)* ']')?
    650662    //  {WILD} 
    651663    ;
     
    653665ComponentReferenceQualified returns ComponentRef::uComponentRef  : 
    654666    {ComponentRef::CREF_QUAL}
    655     name=IDENT ('[' subscripts+=Subscript (',' subscripts+=Subscript)* ']')?
     667    ref=IDENT ('[' subscripts+=Subscript (',' subscripts+=Subscript)* ']')?
    656668    '.' componentRef=ComponentRef
    657669    ;
     
    680692    |{Restriction::R_FUNCTION} 'function'
    681693    |{Restriction::R_ENUMERATION} 'enumeration'
    682     //|{R_PREDEFINED_INT} 'Integer'
    683     //|{R_PREDEFINED_REAL} 'Real'
    684     //|{R_PREDEFINED_STRING} 'String'
    685     //|{R_PREDEFINED_BOOL} 'Boolean'
     694    //|{Restriction::R_PREDEFINED_INT} 'Integer'
     695    //|{Restriction::R_PREDEFINED_REAL} 'Real'
     696    //|{Restriction::R_PREDEFINED_STRING} 'String'
     697    //|{Restriction::R_PREDEFINED_BOOL} 'Boolean'
    686698    ;   
    687699
     
    710722*/
    711723
     724ForIterators returns Iterators::ForIterators :
     725    forIterator+=ForIterator (',' forIterator+=ForIterator)*
     726    ;
     727
    712728ForIterator returns Iterators::ForIterator :
    713729    tuple=ForIteratorTuple
    714     ;
    715 
    716 ForIterators returns Iterators::ForIterators :
    717     forIterator+=ForIterator (',' forIterator+=ForIterator)*
    718730    ;
    719731
Note: See TracChangeset for help on using the changeset viewer.