| 1 |
filetype: sage |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "\\.sage$" |
| 5 |
header: "^#!.*/(env +)?sage( |$)" |
| 6 |
|
| 7 |
rules: |
| 8 |
|
| 9 |
# built-in objects |
| 10 |
- constant: "\\b(None|self|True|False)\\b" |
| 11 |
# built-in attributes |
| 12 |
- constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" |
| 13 |
# built-in functions |
| 14 |
- identifier: "\\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\\b" |
| 15 |
# special method names |
| 16 |
- identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b" |
| 17 |
# types |
| 18 |
- type: "\\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)\\b" |
| 19 |
# definitions |
| 20 |
- identifier: "def [a-zA-Z_0-9]+" |
| 21 |
# keywords |
| 22 |
- statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\\b" |
| 23 |
# decorators |
| 24 |
- brightgreen: "@.*[(]" |
| 25 |
# operators |
| 26 |
- statement: "([.:;,+*|=!\\%@]|<|>|/|-|&)" |
| 27 |
# parentheses |
| 28 |
- statement: "([(){}]|\\[|\\])" |
| 29 |
# numbers |
| 30 |
- constant.number: "\\b[0-9]+\\b" |
| 31 |
|
| 32 |
- comment: |
| 33 |
start: "\"\"\"" |
| 34 |
end: "\"\"\"" |
| 35 |
rules: [] |
| 36 |
|
| 37 |
- comment: |
| 38 |
start: "'''" |
| 39 |
end: "'''" |
| 40 |
rules: [] |
| 41 |
|
| 42 |
- constant.string: |
| 43 |
start: "\"" |
| 44 |
end: "\"" |
| 45 |
skip: "\\\\." |
| 46 |
rules: |
| 47 |
- constant.specialChar: "\\\\." |
| 48 |
|
| 49 |
- constant.string: |
| 50 |
start: "'" |
| 51 |
end: "'" |
| 52 |
skip: "\\\\." |
| 53 |
rules: |
| 54 |
- constant.specialChar: "\\\\." |
| 55 |
|
| 56 |
- comment: |
| 57 |
start: "#" |
| 58 |
end: "$" |
| 59 |
rules: [] |
| 60 |
|