implemented decmatch (artf724241)
[deliverable/titan.core.git] / compiler2 / ttcn3 / compiler.l
index 4497b6ca79a5d4132311a5fafbfdf961a6625a9e..8ef00263a7a2c959aaa8aca27eab21acca01ba5f 100644 (file)
@@ -1,9 +1,26 @@
 /******************************************************************************
- * Copyright (c) 2000-2014 Ericsson Telecom AB
+ * Copyright (c) 2000-2016 Ericsson Telecom AB
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Baji, Laszlo
+ *   Balasko, Jeno
+ *   Baranyi, Botond
+ *   Cserveni, Akos
+ *   Delic, Adam
+ *   Feher, Csaba
+ *   Forstner, Matyas
+ *   Kovacs, Ferenc
+ *   Kremer, Peter
+ *   Raduly, Csaba
+ *   Szabados, Kristof
+ *   Szabo, Bence Janos
+ *   Szabo, Janos Zoltan – initial implementation
+ *   Zalanyi, Balazs Andor
+ *
  ******************************************************************************/
 %option noyywrap
 %option never-interactive
@@ -176,10 +193,13 @@ NEWLINE \r|\n|\r\n
 
 LINEMARKER {NUMBER}{WHITESPACE}+\"([^\\\"\r\n]|\\[^\r\n])*\"
 
+UID [uU][+]?[0-9A-Fa-f]{1,8}
+
 TITAN "$#&&&(#TITANERRONEOUS$#&&^#% "
 
 %x SC_blockcomment SC_cstring
 %x SC_binstring SC_binstring_bad
+%s SC_charkeyword
 
 %%
   /* local variables of yylex() */
@@ -256,10 +276,6 @@ TITAN "$#&&&(#TITANERRONEOUS$#&&^#% "
 }
 
 {LINECOMMENT} {
-  Location loc(infile, current_line, current_column, current_line,
-    current_column + yyleng);
-  loc.error("Unterminated line comment (missing newline character at the end "
-    "of file)");
   current_column += yyleng;
 }
 
@@ -362,8 +378,9 @@ break               RETURN(BreakKeyword);
 call           RETURN_DOT(CallOpKeyword);
 case           RETURN(CaseKeyword);
 catch          RETURN_DOT(CatchOpKeyword);
-char           RETURN(CharKeyword);
+char           { BEGIN(SC_charkeyword); RETURN(CharKeyword); }
 charstring     RETURN(CharStringKeyword);
+checkstate      RETURN_DOT(CheckStateKeyword);
 check          RETURN_DOT(CheckOpKeyword);
 clear          RETURN_DOT(ClearOpKeyword);
 complement     RETURN(ComplementKeyword);
@@ -373,6 +390,7 @@ const               RETURN(ConstKeyword);
 continue       RETURN(ContinueKeyword);
 control                RETURN(ControlKeyword);
 create         RETURN_DOT(CreateKeyword);
+decmatch       RETURN(DecodedMatchKeyword);
 deactivate     RETURN(DeactivateKeyword);
 default                RETURN(DefaultKeyword);
 derefers       RETURN(DerefersKeyword);
@@ -499,13 +517,18 @@ with              RETURN(WithKeyword);
 xor            RETURN(XorKeyword);
 xor4b          RETURN(Xor4bKeyword);
 
+  /* modifier keywords */
+
+"@nocase" RETURN(NocaseKeyword);
+"@lazy"   RETURN(LazyKeyword);
+
   /* special TITAN specific keywords */
 
 "@try"    RETURN(TitanSpecificTryKeyword);
 "@catch"  RETURN(TitanSpecificCatchKeyword);
-"@lazy"   RETURN(TitanSpecificLazyKeyword);
 "@profiler" RETURN(TitanSpecificProfilerKeyword);
 
+
        /* Predefined function identifiers */
 
 bit2hex                RETURN(bit2hexKeyword);
@@ -523,6 +546,7 @@ hex2oct             RETURN(hex2octKeyword);
 hex2str                RETURN(hex2strKeyword);
 int2bit                RETURN(int2bitKeyword);
 int2char       RETURN(int2charKeyword);
+int2enum  RETURN(int2enumKeyword);
 int2float      RETURN(int2floatKeyword);
 int2hex                RETURN(int2hexKeyword);
 int2oct                RETURN(int2octKeyword);
@@ -563,6 +587,10 @@ remove_bom RETURN(remove_bomKeyWord);
 get_stringencoding     RETURN(get_stringencodingKeyWord);
 encode_base64  RETURN(encode_base64KeyWord);
 decode_base64  RETURN(decode_base64KeyWord);
+encvalue_unichar RETURN(encvalue_unicharKeyWord);
+decvalue_unichar RETURN(decvalue_unicharKeyWord);
+any2unistr      RETURN(any2unistrKeyWord);
+hostid          RETURN(hostidKeyWord);
 
        /* Values */
 
@@ -603,6 +631,18 @@ NULL RETURN(NullValue);
   current_column++;
   MD5_Update(&md5_ctx, yytext, yyleng);
   BEGIN(SC_cstring);
+}  
+
+<SC_charkeyword>
+{  
+  {UID} {
+    yylval.str = mcopystrn(yytext, yyleng);
+    RETURN_LVAL(Cstring);
+  }
+
+  [,] { RETURN(*yytext); }
+
+  [)] { BEGIN(INITIAL); RETURN(*yytext); }
 }
 
 <SC_binstring> /* -------- SC_binstring scope -------------- */
This page took 0.026266 seconds and 5 git commands to generate.