rta: add_monomorphic_send mark the mproperty as live
[nit.git] / src / parser / nit.sablecc3xx
index f76d2d5..5326b1b 100644 (file)
@@ -51,15 +51,18 @@ sstr_body = sstr_char*;
 
 long_str_char = str_char | cr | lf;
 
+// because no substraction in sablecc3, complex long strings are difficult to express
+ls1 = '"' '"'? ;
+ls2 = '{' '{'? ;
+ls12 = ls1? (ls2 ls1)* ls2?;
+
 long_str_part
-        = long_str_char
-        | '"' long_str_char
-        | '"' '"' long_str_char
-        | '{' long_str_char
-        | '{' '{' long_str_char
+        = ls12 long_str_char
         ;
 
 long_str_body = long_str_part*;
+lsend1 = ls2? (ls1 ls2)* '"""' '"'*;
+lsend2 = ls1? (ls2 ls1)* '{{{' '{'*;
 
 long_sstr_char = sstr_char | cr | lf;
 long_sstr_part
@@ -180,10 +183,10 @@ attrid = '_' lowercase letter*;
 
 number = digit+;
 float = digit* '.' digit+;
-string = '"' str_body '"' | '"' '"' '"' long_str_body '"' '"' '"' | ''' ''' ''' long_sstr_body ''' ''' ''';
-start_string = '"' str_body '{' | '"' '"' '"' long_str_body '{' '{' '{';
-mid_string = '}' str_body '{' | '}' '}' '}' long_str_body '{' '{' '{';
-end_string = '}' str_body '"' | '}' '}' '}' long_str_body '"' '"' '"';
+string = '"' str_body '"' | '"' '"' '"' long_str_body lsend1 | ''' ''' ''' long_sstr_body ''' ''' ''';
+start_string = '"' str_body '{' | '"' '"' '"' long_str_body lsend2;
+mid_string = '}' str_body '{' | '}' '}' '}' long_str_body lsend2;
+end_string = '}' str_body '"' | '}' '}' '}' long_str_body lsend1;
 char = (''' [[any - '''] - '\'] ''') | (''' '\' any ''');
 bad_string = ('"'|'}') str_body | '"' '"' '"' long_str_body | ''' ''' ''' long_sstr_body;
 bad_char = ''' '\'? any;
@@ -347,13 +350,14 @@ extern_call {-> extern_call}
     ;
 extern_call_prop {-> extern_call}
     = {local} methid {-> New extern_call.local_prop( methid )}
-       | {full} classid quad methid {-> New extern_call.full_prop( classid, quad, methid )}
-       | {init} classid {-> New extern_call.init_prop( classid )}
+       | {full} type quad methid {-> New extern_call.full_prop( type, Null, methid )}
+       | {full2} type dot methid {-> New extern_call.full_prop( type, dot, methid )}
+       | {init} type {-> New extern_call.init_prop( type )}
        ;
 extern_call_cast {-> extern_call}
-    = {as_cast} [from_type]:type kwas [n2]:no opar [n3]:no [to_type]:type [n4]:no cpar {-> New extern_call.cast_as(from_type, kwas, to_type)}
-       | {as_nullable} type kwas [n2]:no kwnullable {-> New extern_call.as_nullable( type, kwas, kwnullable)}
-       | {as_not_nullable} type kwas [n2]:no kwnot [n3]:no kwnullable {-> New extern_call.as_not_nullable( type, kwas, kwnot, kwnullable)}
+    = {as_cast} [from_type]:type dot? kwas [n2]:no opar [n3]:no [to_type]:type [n4]:no cpar {-> New extern_call.cast_as(from_type, dot, kwas, to_type)}
+       | {as_nullable} type dot? kwas [n2]:no kwnullable {-> New extern_call.as_nullable( type, kwas, kwnullable)}
+       | {as_not_nullable} type dot? kwas [n2]:no kwnot [n3]:no kwnullable {-> New extern_call.as_not_nullable( type, kwas, kwnot, kwnullable)}
        ;
 
 in_language = kwin string;
@@ -558,11 +562,15 @@ expr_atom~nopar~nobra {-> expr}
 superstring {-> expr} 
        = superstring_start superstring_middle* superstring_end annotations? {-> New expr.superstring([superstring_start.expr, superstring_middle.expr, superstring_end.expr], annotations)};
 superstring_start {-> expr*}
-       = start_string_p no expr [n2]:no {-> [start_string_p.expr, expr]};
+       = start_string_p no expr [n2]:no {-> [start_string_p.expr, expr]}
+       | {noexpr} start_string_p no {-> [start_string_p.expr]}
+       ;
 start_string_p {-> expr}
        = start_string {-> New expr.start_string(start_string)};
 superstring_middle {-> expr*}
-       = mid_string_p no expr [n2]:no {-> [mid_string_p.expr, expr]};
+       = mid_string_p no expr [n2]:no {-> [mid_string_p.expr, expr]}
+       | {noexpr} mid_string_p no {-> [mid_string_p.expr]}
+       ;
 mid_string_p {-> expr}
        = mid_string {-> New expr.mid_string(mid_string)};
 superstring_end {-> expr}
@@ -842,9 +850,9 @@ extern_calls = kwimport [extern_calls]:extern_call*
 extern_call =
        | {super} kwsuper
        | {local_prop} methid
-       | {full_prop} classid quad? methid
-       | {init_prop} classid
-       | {cast_as} [from_type]:type kwas [to_type]:type
+       | {full_prop} type dot? methid
+       | {init_prop} type
+       | {cast_as} [from_type]:type dot? kwas [to_type]:type
        | {as_nullable} type kwas kwnullable
        | {as_not_nullable} type kwas kwnot kwnullable
        ;