blob: 31fa06035cbc0255639f0a942b71a342e1cf540b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2006-2010, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.util.parsing
package combinator
package syntactical
import token._
import lexical.StdLexical
/** This component provides primitive parsers for the standard tokens defined in `StdTokens'.
*
* @author Martin Odersky, Adriaan Moors
*/
class StandardTokenParsers extends StdTokenParsers {
type Tokens = StdTokens
val lexical = new StdLexical
//an implicit keyword function that gives a warning when a given word is not in the reserved/delimiters list
override implicit def keyword(chars : String): Parser[String] =
if(lexical.reserved.contains(chars) || lexical.delimiters.contains(chars)) super.keyword(chars)
else failure("You are trying to parse \""+chars+"\", but it is neither contained in the delimiters list, nor in the reserved keyword list of your lexical object")
}
|