Compare commits
2 Commits
hg-default
...
main
Author | SHA1 | Date |
---|---|---|
~d6 | bd6826c0aa | |
~d6 | a3eca840c2 |
|
@ -0,0 +1,6 @@
|
|||
syntax: glob
|
||||
*.pyc
|
||||
*.pyo
|
||||
*~
|
||||
TAGS
|
||||
__pycache__
|
|
@ -179,7 +179,7 @@ class Application(object):
|
|||
'awk', 'shell', 'shellmini', 'fstab', 'yacc', 'pipe', 'mbox',
|
||||
'error', 'lua', 'lily', 'forth', 'ebnf', 'colortest', 'go',
|
||||
'inform6', 'scala', 'markdown', 'roy', 'twine', 'idris', 'rust',
|
||||
'bosatsu', 'tal',
|
||||
'bosatsu', 'tal', 'modal',
|
||||
)
|
||||
for name in names:
|
||||
exec("import mode.%s; mode.%s.install(self)" % (name, name))
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
from mode import Fundamental
|
||||
from lex import Grammar, PatternRule, RegionRule
|
||||
|
||||
class DataGrammar(Grammar):
|
||||
pass
|
||||
|
||||
DataGrammar.rules = [
|
||||
PatternRule('spaces', ' +'),
|
||||
RegionRule('sequence', r'\(', DataGrammar, r'\)|$'),
|
||||
PatternRule('register', r'\?[a-z]'),
|
||||
PatternRule('word', r'[^() \n]+'),
|
||||
]
|
||||
|
||||
class RuleGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule('spaces', ' +'),
|
||||
RegionRule('group', r'\(', DataGrammar, r'\)|$'),
|
||||
PatternRule('register', r'\?[a-z]'),
|
||||
PatternRule('word', r'[^() \n]+'),
|
||||
]
|
||||
|
||||
class ModalGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule('spaces', ' +'),
|
||||
PatternRule('eol', r'\n'),
|
||||
RegionRule('modal.rule', '<>', RuleGrammar, '\n|$'),
|
||||
PatternRule('modal.lit', r'[^\n]+'),
|
||||
]
|
||||
|
||||
class Modal(Fundamental):
|
||||
name = 'Modal'
|
||||
extensions = ['.modal']
|
||||
grammar = ModalGrammar
|
||||
colors = {
|
||||
'modal.lit': ('cyan', 'default'),
|
||||
'modal.rule.start': ('magenta', 'default'),
|
||||
'register': ('yellow', 'default'),
|
||||
'modal.rule.group.start': ('blue', 'default'),
|
||||
'modal.rule.group.end': ('blue', 'default'),
|
||||
}
|
||||
|
||||
def install(*args):
|
||||
Modal.install(*args)
|
Loading…
Reference in New Issue