lexical.scala
来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 42 行
SCALA
42 行
/* __ *\** ________ ___ / / ___ Scala API **** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL **** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **** /____/\___/_/ |_/____/_/ | | **** |/ **\* */// $Id: Lexical.scala 13911 2008-02-07 12:39:51Z moors $package scala.util.parsing.combinatorold.lexicalimport scala.util.parsing.syntax._import scala.util.parsing.input.CharArrayReader.EofCh/** <p> * This component complements the <code>Scanners</code> component with * common operations for lexical parsers. * </p> * <p> * {@see StdLexical} for a concrete implementation for a simple, Scala-like * language. * </p> * * @author Martin Odersky, Adriaan Moors */abstract class Lexical extends Scanners with Tokens { /** A character-parser that matches a letter (and returns it)*/ def letter = elem("letter", _.isLetter) /** A character-parser that matches a digit (and returns it)*/ def digit = elem("digit", _.isDigit) /** A character-parser that matches any character except the ones given in `cs' (and returns it)*/ def chrExcept(cs: Char*) = elem("", ch => (cs forall (ch !=))) /** A character-parser that matches a white-space character (and returns it)*/ def whitespaceChar = elem("space char", ch => ch <= ' ' && ch != EofCh)}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?