added scala strings and symbols

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-08-11 08:55:30 -04:00
parent 2cb5939d3d
commit ac0fb2afb2
1 changed files with 13 additions and 8 deletions

View File

@ -1,12 +1,11 @@
import commands
import time
from tab import StackTabber
from method import Method
#import commands
#from tab import StackTabber
#from method import Method
from mode import Fundamental
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
from mode.python import StringGrammar1, StringGrammar2
from mode.pipe import Pipe
from method.shell import Interact
#from mode.pipe import Pipe
#from method.shell import Interact
chr1 = '[a-zA-Z_]'
chr2 = '[a-zA-Z_0-9]'
@ -18,6 +17,12 @@ NestedCommentGrammar.rules = [
PatternRule('data', r'(?:[^\*]|\*(?!/))+'),
]
class StringGrammar(Grammar):
rules = [
PatternRule('escaped', r"\\u[0-9A-Fa-f]{4}|\\[0-7]{1,3}|\\[btnfr\"'\\]"),
PatternRule('data', r'[^\\"]+'),
]
class ScalaGrammar(Grammar):
rules = [
PatternRule('scala.comment', '//.*$'),
@ -37,8 +42,8 @@ class ScalaGrammar(Grammar):
PatternRule('scala.bool', '(?:true|false)(?![a-zA-Z0-9_])'),
PatternRule('scala.char', r"'(?:[^'\\]|\\u[0-9A-Fa-f]{4}|\\[0-7]{1,3}|\\[btnfr\"'\\])'"),
#PatternRule('scala.string', '-?[0-9]'),
#PatternRule('scala.symbol', '-?[0-9]'),
RegionRule('scala.string', '"', StringGrammar, '"'),
PatternRule('scala.symbol', "'[a-zA-Z_][a-zA-Z0-9_]*"),
PatternRule('scalar.null', 'null'),
]