Ignore:
Timestamp:
12/05/09 15:56:01 (15 years ago)
Author:
nasko
Message:

Fixed some problem with the grammar file

File:
1 edited

Legend:

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

    r552 r553  
    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)*
     
    294294    ;
    295295
    296 AlgorithmIf returns AlgorithmStatement::ALG_IF:
     296AlgorithmIf returns AlgorithmStatement::uAlgorithmStatement :
     297    {AlgorithmStatement::ALG_IF}
    297298    'if' ifExp=Expression 'then' (trueBranch+=AlgorithmItem)*
    298299    (elseIfAlgorithmBranch+=ElseIfAlgorithmBranch)*
     
    305306    ;
    306307
    307 AlgorithmAssign returns AlgorithmStatement::ALG_ASSIGN:
    308     assignComponent=ExprRange ':=' value=Expression
    309     ;
    310 AlgorithmNoRetCall returns AlgorithmStatement::ALG_NORETCALL :
     308AlgorithmAssign returns AlgorithmStatement::uAlgorithmStatement :
     309    {AlgorithmStatement::ALG_ASSIGN} assignComponent=ExprRange ':=' value=Expression
     310    ;
     311AlgorithmNoRetCall returns  AlgorithmStatement::uAlgorithmStatement:
     312    {AlgorithmStatement::ALG_NORETCALL}
    311313    functionCall=ComponentRef '(' functionArgs=FunctionArguments? ')'
    312314    ;
     
    316318    ;
    317319
    318 AlgorithmWhen returns AlgorithmStatement::ALG_WHEN_A :
     320AlgorithmWhen returns AlgorithmStatement::uAlgorithmStatement :
     321    {AlgorithmStatement::ALG_WHEN_A}
    319322    'when' boolExpr=Expression 'then' (whenBody+=AlgorithmItem)
    320323    (elseWhenAlgorithmBranch+=ElseWhenAlgorithmBranch)*
     
    416419
    417420ExprRange returns Exp::uExp :
    418     ExprLogical ({Exp::RANGE.start=current} ':'  stop=ExprLogical
    419     | {Exp::RANGE.start=current} ':' step=ExprLogical ':' stop=ExprLogical )?
     421    ExprLogical ({Exp::RANGE.start=current} ':'  (step=ExprLogical ':' stop=ExprLogical | stop=ExprLogical) )?
    420422    ;
    421423   
     
    435437ExprRelation returns Exp::uExp :
    436438    ExprArithmetic
    437     ({Exp::RELATION.exp1=current}  op=OperatorLogical exp2=ExprArithmetic)?
     439    ({Exp::RELATION.exp1=current} op = (OperatorLess | OperatorLessEq | OperatorGreater |
     440    OperatorGreaterEq | OperatorEqual | OperatorEqual)  exp2=ExprArithmetic)?
    438441    ;
    439442
    440443ExprArithmetic returns Exp::uExp :
    441444    ExprUnaryArithmetic
    442     ({Exp::BINARY.exp1=current} op=OperatorAddSub exp2=ExprArithmetic2)?
     445    ({Exp::BINARY.exp1=current} op=(OperatorAdd | OperatorSub | OperatorAddEW | OperatorSubEW)
     446    exp2=ExprArithmetic2)?
    443447    ;
    444448
    445449ExprArithmetic2 returns Exp::uExp :
    446450    ExprArithmeticTerm
    447     ({Exp::BINARY.exp1=current} op=OperatorAddSub exp2=ExprArithmetic2)?
     451    ({Exp::BINARY.exp1=current} op=(OperatorAdd | OperatorSub | OperatorAddEW | OperatorSubEW)
     452    exp2=ExprArithmetic2)?
    448453    ;
    449454
     
    550555    Operators
    551556*/
    552 
     557/*
    553558OperatorLogical returns Operator::uOperator:
    554559    {Operator::LESS} '<' | {Operator::LESSEQ} '<=' | {Operator::GREATER} '>'
     
    557562
    558563OperatorAddSub returns Operator::uOperator:
    559     {Operator::ADD} '+' | {Operator::SUB} '-' | {Operator::ADD_EW} '.+' | {Operator::SUB_EW} '.-'
    560     ;
    561 
     564    {Operator::SUB} '-' | {Operator::ADD} '+' | {Operator::ADD_EW} '.+' | {Operator::SUB_EW} '.-'
     565    ;
     566*/
    562567   
    563568OperatorAdd returns Operator::ADD :
Note: See TracChangeset for help on using the changeset viewer.