From cdc44429a2791b5a3c70cca38aa3aaa6d4e0d889 Mon Sep 17 00:00:00 2001 From: Jonathan Brachthäuser Date: Wed, 21 Dec 2016 21:41:03 +0100 Subject: Fill in definitions from 2.12 --- docs/docs/internals/syntax.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/docs/internals/syntax.md b/docs/docs/internals/syntax.md index 7e249d6a0..34acae2f4 100644 --- a/docs/docs/internals/syntax.md +++ b/docs/docs/internals/syntax.md @@ -21,13 +21,18 @@ The lexical syntax of Scala is given by the following grammar in EBNF form. ```ebnf +whiteSpace ::= ‘\u0020’ | ‘\u0009’ | ‘\u000D’ | ‘\u000A’ upper ::= ‘A’ | … | ‘Z’ | ‘\$’ | ‘_’ “… and Unicode category Lu” lower ::= ‘a’ | … | ‘z’ “… and Unicode category Ll” letter ::= upper | lower “… and Unicode categories Lo, Lt, Nl” digit ::= ‘0’ | … | ‘9’ +paren ::= ‘(’ | ‘)’ | ‘[’ | ‘]’ | ‘{’ | ‘}’ +delim ::= ‘`’ | ‘'’ | ‘"’ | ‘.’ | ‘;’ | ‘,’ opchar ::= “printableChar not matched by (whiteSpace | upper | lower | letter | digit | paren | delim | opchar | Unicode_Sm | Unicode_So)” +printableChar ::= “all characters in [\u0020, \u007F] inclusive” +charEscapeSeq ::= ‘\’ (‘b’ | ‘t’ | ‘n’ | ‘f’ | ‘r’ | ‘"’ | ‘'’ | ‘\’) op ::= opchar {opchar} varid ::= lower idrest @@ -36,7 +41,7 @@ alphaid ::= upper idrest plainid ::= alphaid | op id ::= plainid - | ‘\`’ stringLit ‘\`’ + | ‘`’ { charNoBackQuoteOrNewline | UnicodeEscape | charEscapeSeq } ‘`’ | INT // interpolation id, only for quasi-quotes idrest ::= {letter | digit} [‘_’ op] @@ -51,20 +56,19 @@ floatingPointLiteral | ‘.’ digit {digit} [exponentPart] [floatType] | digit {digit} exponentPart [floatType] | digit {digit} [exponentPart] floatType - exponentPart ::= (‘E’ | ‘e’) [‘+’ | ‘-’] digit {digit} floatType ::= ‘F’ | ‘f’ | ‘D’ | ‘d’ + booleanLiteral ::= ‘true’ | ‘false’ -characterLiteral ::= ‘\'’ printableChar ‘\'’ - | ‘\'’ charEscapeSeq ‘\'’ +characterLiteral ::= ‘'’ (printableChar | charEscapeSeq) ‘'’ stringLiteral ::= ‘"’ {stringElement} ‘"’ - | ‘"""’ {[‘"’] [‘"’] char \ ‘"’} {‘"’} ‘"""’ + | ‘"""’ multiLineChars ‘"""’ stringElement ::= printableChar \ (‘"’ | ‘\’) + | UnicodeEscape | charEscapeSeq -charEscapeSeq ::= ‘\b’ | ‘\n’ | ‘\t’ | ‘\f’ | ‘\r’ | ‘"’ | ‘'’ | ‘\\’ - +multiLineChars ::= {[‘"’] [‘"’] char \ ‘"’} {‘"’} processedStringLiteral ::= alphaid ‘"’ {printableChar \ (‘"’ | ‘$’) | escape} ‘"’ | alphaid ‘"""’ {[‘"’] [‘"’] char \ (‘"’ | ‘$’) | escape} {‘"’} ‘"""’ @@ -72,7 +76,6 @@ escape ::= ‘$$’ \comment{$} | ‘$’ letter { letter | digit } | ‘{’ Block [‘;’ whiteSpace stringFormat whiteSpace] ‘}’ stringFormat ::= {printableChar \ (‘"’ | ‘}’ | ‘ ’ | ‘\t’ | ‘\n’)} -whiteSpace ::= {‘ ’ | ‘\t’} symbolLiteral ::= ‘'’ plainid -- cgit v1.2.3