Class ForeignSyntax
java.lang.Object
org.ek9lang.compiler.repair.ForeignSyntax
Spellings carried over from other languages that EK9 writes one way and parses no other way. Each rule rewrites
only code (never the inside of a String or a comment - see
SourceLines.masked(String)) and only on the line the
parser stopped on (or, for a generic type, the line before - the parser notices it a line late):
&&/||- EK9'sand/or;- a trailing
:on a control line (if x:,else:,while x:) - Python's block colon; EK9 blocks are opened by indentation alone; - a
#comment line -//; - a C block comment (slash-star ... star-slash) - EK9's
<!- ... -!>; List<String>()/as List<String>/Dict<K, V>- EK9'sList() of String/List of String/Dict of (K, V).
-
Method Summary
Modifier and TypeMethodDescription(package private) static TextRule.RewriteblockComment(List<String> lines, SyntaxProbe.SyntaxError failure) A C block comment (slash-star ...(package private) static TextRule.RewritegenericType(List<String> lines, SyntaxProbe.SyntaxError failure) List<String>()-List() of String;as List<String>-as List of String.(package private) static TextRule.RewritehashComment(List<String> lines, SyntaxProbe.SyntaxError failure) # note-// note.(package private) static TextRule.RewritelogicalOperators(List<String> lines, SyntaxProbe.SyntaxError failure) a && b/a || b-a and b/a or b.(package private) static TextRule.RewritetrailingColon(List<String> lines, SyntaxProbe.SyntaxError failure) if total > 1:- the trailing colon dropped.
-
Method Details
-
logicalOperators
a && b/a || b-a and b/a or b. -
trailingColon
if total > 1:- the trailing colon dropped. -
hashComment
# note-// note. -
blockComment
A C block comment (slash-star ... star-slash), on one line or several -<!- note -!>. -
genericType
List<String>()-List() of String;as List<String>-as List of String.
-