diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-12-28 09:15:07 +0100 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-12-28 09:15:07 +0100 |
commit | 8eba9de819131993fd056a8833fb384de0904a8c (patch) | |
tree | 6defbb256def036644167b3f77e7e1814c103ada /scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala | |
parent | a84c09efcb2d843ee04ee3299ceb592a00a42267 (diff) | |
download | hands-on-scala-js-8eba9de819131993fd056a8833fb384de0904a8c.tar.gz hands-on-scala-js-8eba9de819131993fd056a8833fb384de0904a8c.tar.bz2 hands-on-scala-js-8eba9de819131993fd056a8833fb384de0904a8c.zip |
Remove Scalatex from source tree (it's now in a separate project)
Diffstat (limited to 'scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala')
-rw-r--r-- | scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala b/scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala deleted file mode 100644 index 9fd9d5b..0000000 --- a/scalatex/scalaParser/src/main/scala/scalaParser/syntax/Literals.scala +++ /dev/null @@ -1,58 +0,0 @@ -package scalaParser -package syntax -import acyclic.file -import org.parboiled2._ - -trait Literals { self: Parser with Basic with Identifiers => - object Literals{ - import Basic._ - def FloatingPointLiteral = rule { - - "." ~ oneOrMore(Digit) ~ optional(ExponentPart) ~ optional(FloatType) | - oneOrMore(Digit) ~ ( - "." ~ oneOrMore(Digit) ~ optional(ExponentPart) ~ optional(FloatType) | - ExponentPart ~ optional(FloatType) | - optional(ExponentPart) ~ FloatType - ) - } - - def IntegerLiteral = rule { (DecimalNumeral | HexNumeral) ~ optional(anyOf("Ll")) } - - def BooleanLiteral = rule { Key.W("true") | Key.W("false") } - - def MultilineComment: Rule0 = rule { "/*" ~ zeroOrMore(MultilineComment | !"*/" ~ ANY) ~ "*/" } - def Comment: Rule0 = rule { - MultilineComment | - "//" ~ zeroOrMore(!Basic.Newline ~ ANY) ~ &(Basic.Newline | EOI) - } - - def Literal = rule { - (optional("-") ~ (FloatingPointLiteral | IntegerLiteral)) | - BooleanLiteral | - CharacterLiteral | - StringLiteral | - SymbolLiteral | - (Key.W("null") ~ !(Basic.Letter | Basic.Digit)) - } - - - def EscapedChars = rule { '\\' ~ anyOf("rnt\\\"") } - - // Note that symbols can take on the same values as keywords! - def SymbolLiteral = rule { ''' ~ (Identifiers.PlainId | Identifiers.Keywords) } - - def CharacterLiteral = rule { ''' ~ (UnicodeExcape | EscapedChars | !'\\' ~ CharPredicate.from(isPrintableChar)) ~ ''' } - - def MultiLineChars = rule { zeroOrMore(optional('"') ~ optional('"') ~ noneOf("\"")) } - def StringLiteral = rule { - (optional(Identifiers.Id) ~ "\"\"\"" ~ MultiLineChars ~ ("\"\"\"" ~ zeroOrMore('"'))) | - (optional(Identifiers.Id) ~ '"' ~ zeroOrMore("\\\"" | noneOf("\n\"")) ~ '"') - } - - def isPrintableChar(c: Char): Boolean = { - val block = Character.UnicodeBlock.of(c) - !Character.isISOControl(c) && !Character.isSurrogate(c) && block != null && block != Character.UnicodeBlock.SPECIALS - } - } -} - |