Skip to content

Commit

Permalink
Fixed rule "relation"
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@69 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x97davka committed Dec 9, 1997
1 parent 1b95bd5 commit 99ceb6f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions modeq/ast/modgram.g
Expand Up @@ -134,14 +134,20 @@ extern void *sibling_list(AST *ast);
#token MULT "\*"
#token DIV "/"
#token DOT "."
#token LESS "<"
#token LESSEQ "<="
#token GREATER ">"
#token GREATEREQ ">="
#token EQEQ "=="
#token LESSGT "<>"

/* #tokclass COMP_BEGIN { LPAR RECORD_BEGIN } */
/* #tokclass COMP_END { RPAR RECORD_END } */

/* #tokclass ARR_ARG_BEG { LPAR LBRACK } */
/* #tokclass ARR_ARG_END { RPAR RBRACK } */

#tokclass REL_OP { "<" "<=" ">" ">=" "==" "<>" }
#tokclass REL_OP { LESS LESSEQ GREATER GREATEREQ EQEQ LESSGT }
#tokclass ADD_OP { PLUS MINUS }
#tokclass MUL_OP { MULT DIV }

Expand Down Expand Up @@ -615,12 +621,16 @@ logical_factor :
| relation
;

relation :
arithmetic_expression
{ rel:REL_OP^ arithmetic_expression
<< /* if (!strcmp(mytoken($rel)->getText(),"<>")) #rel->setTranslation("!=");
else if (!strcmp(mytoken($rel)->getText(),"==")) #rel->setTranslation("==="); */
>>
relation : << void *relop; >>
e1:arithmetic_expression
{ ( LESS^ << relop = Exp__LESS; >>
| LESSEQ^ << relop = Exp__LESSEQ; >>
| GREATER^ << relop = Exp__GREATER; >>
| GREATEREQ^ << relop = Exp__GREATEREQ; >>
| EQEQ^ << relop = Exp__EQUAL; >>
| LESSGT^ << relop = Exp__NEQUAL; >>
) e2:arithmetic_expression
<< #0->rml = Exp__RELATION(#e1->rml, relop, #e2->rml); >>
}
;

Expand Down

0 comments on commit 99ceb6f

Please sign in to comment.