src/Pure/Isar/token.scala
changeset 48754 c2c1e5944536
parent 48718 73e6c22e2d94
child 51048 123be08eed88
equal deleted inserted replaced
48753:5e57a6f24cdb 48754:c2c1e5944536
    26     val STRING = Value("string")
    26     val STRING = Value("string")
    27     val ALT_STRING = Value("back-quoted string")
    27     val ALT_STRING = Value("back-quoted string")
    28     val VERBATIM = Value("verbatim text")
    28     val VERBATIM = Value("verbatim text")
    29     val SPACE = Value("white space")
    29     val SPACE = Value("white space")
    30     val COMMENT = Value("comment text")
    30     val COMMENT = Value("comment text")
       
    31     val ERROR = Value("bad input")
    31     val UNPARSED = Value("unparsed input")
    32     val UNPARSED = Value("unparsed input")
    32   }
    33   }
    33 
    34 
    34 
    35 
    35   /* token reader */
    36   /* token reader */
    87   def is_xname: Boolean = is_name || kind == Token.Kind.LONG_IDENT
    88   def is_xname: Boolean = is_name || kind == Token.Kind.LONG_IDENT
    88   def is_text: Boolean = is_xname || kind == Token.Kind.VERBATIM
    89   def is_text: Boolean = is_xname || kind == Token.Kind.VERBATIM
    89   def is_space: Boolean = kind == Token.Kind.SPACE
    90   def is_space: Boolean = kind == Token.Kind.SPACE
    90   def is_comment: Boolean = kind == Token.Kind.COMMENT
    91   def is_comment: Boolean = kind == Token.Kind.COMMENT
    91   def is_proper: Boolean = !is_space && !is_comment
    92   def is_proper: Boolean = !is_space && !is_comment
       
    93   def is_error: Boolean = kind == Token.Kind.ERROR
    92   def is_unparsed: Boolean = kind == Token.Kind.UNPARSED
    94   def is_unparsed: Boolean = kind == Token.Kind.UNPARSED
       
    95 
       
    96   def is_unfinished: Boolean = is_error &&
       
    97    (source.startsWith("\"") ||
       
    98     source.startsWith("`") ||
       
    99     source.startsWith("{*") ||
       
   100     source.startsWith("(*"))
    93 
   101 
    94   def is_begin: Boolean = is_keyword && source == "begin"
   102   def is_begin: Boolean = is_keyword && source == "begin"
    95   def is_end: Boolean = is_keyword && source == "end"
   103   def is_end: Boolean = is_keyword && source == "end"
    96 
   104 
    97   def content: String =
   105   def content: String =