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
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;
;
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;
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}
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
;