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