155 yield index, Name.Builtin, value |
155 yield index, Name.Builtin, value |
156 continue |
156 continue |
157 elif '.' in value: |
157 elif '.' in value: |
158 a, b = value.split('.') |
158 a, b = value.split('.') |
159 yield index, Name, a |
159 yield index, Name, a |
160 yield index + len(a), Punctuation, u'.' |
160 yield index + len(a), Punctuation, '.' |
161 yield index + len(a) + 1, Name, b |
161 yield index + len(a) + 1, Name, b |
162 continue |
162 continue |
163 yield index, token, value |
163 yield index, token, value |
164 |
164 |
165 class MoonScriptLexer(LuaLexer): |
165 class MoonScriptLexer(LuaLexer): |
657 'windows menu', 'wraps', 'zoomable', 'zoomed') |
657 'windows menu', 'wraps', 'zoomable', 'zoomed') |
658 |
658 |
659 tokens = { |
659 tokens = { |
660 'root': [ |
660 'root': [ |
661 (r'\s+', Text), |
661 (r'\s+', Text), |
662 (u'¬\\n', String.Escape), |
662 (r'¬\n', String.Escape), |
663 (r"'s\s+", Text), # This is a possessive, consider moving |
663 (r"'s\s+", Text), # This is a possessive, consider moving |
664 (r'(--|#).*?$', Comment), |
664 (r'(--|#).*?$', Comment), |
665 (r'\(\*', Comment.Multiline, 'comment'), |
665 (r'\(\*', Comment.Multiline, 'comment'), |
666 (r'[(){}!,.:]', Punctuation), |
666 (r'[(){}!,.:]', Punctuation), |
667 (u'(«)([^»]+)(»)', |
667 (r'(«)([^»]+)(»)', |
668 bygroups(Text, Name.Builtin, Text)), |
668 bygroups(Text, Name.Builtin, Text)), |
669 (r'\b((?:considering|ignoring)\s*)' |
669 (r'\b((?:considering|ignoring)\s*)' |
670 r'(application responses|case|diacriticals|hyphens|' |
670 r'(application responses|case|diacriticals|hyphens|' |
671 r'numeric strings|punctuation|white space)', |
671 r'numeric strings|punctuation|white space)', |
672 bygroups(Keyword, Name.Builtin)), |
672 bygroups(Keyword, Name.Builtin)), |
673 (u'(-|\\*|\\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\\^)', Operator), |
673 (r'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator), |
674 (r"\b(%s)\b" % '|'.join(Operators), Operator.Word), |
674 (r"\b(%s)\b" % '|'.join(Operators), Operator.Word), |
675 (r'^(\s*(?:on|end)\s+)' |
675 (r'^(\s*(?:on|end)\s+)' |
676 r'(%s)' % '|'.join(StudioEvents[::-1]), |
676 r'(%s)' % '|'.join(StudioEvents[::-1]), |
677 bygroups(Keyword, Name.Function)), |
677 bygroups(Keyword, Name.Function)), |
678 (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)), |
678 (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)), |
974 _DELIMITERS = r' \'.,():\n' |
974 _DELIMITERS = r' \'.,():\n' |
975 _DELIMITERS_OR_COMENT = _DELIMITERS + '*' |
975 _DELIMITERS_OR_COMENT = _DELIMITERS + '*' |
976 _DELIMITER_PATTERN = '[' + _DELIMITERS + ']' |
976 _DELIMITER_PATTERN = '[' + _DELIMITERS + ']' |
977 _DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')' |
977 _DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')' |
978 _NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']' |
978 _NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']' |
979 _OPERATORS_PATTERN = u'[.+\\-/=\\[\\](){}<>;,&%¬]' |
979 _OPERATORS_PATTERN = '[.+\\-/=\\[\\](){}<>;,&%¬]' |
980 _KEYWORDS = [ |
980 _KEYWORDS = [ |
981 'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR', |
981 'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR', |
982 'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU', |
982 'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU', |
983 'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR', |
983 'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR', |
984 'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D', |
984 'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D', |
1251 (words(( |
1251 (words(( |
1252 'break', 'continue', 'else', 'end', 'for', 'function', 'if', |
1252 'break', 'continue', 'else', 'end', 'for', 'function', 'if', |
1253 'in', 'isa', 'then', 'repeat', 'return', 'while'), suffix=r'\b'), |
1253 'in', 'isa', 'then', 'repeat', 'return', 'while'), suffix=r'\b'), |
1254 Keyword), |
1254 Keyword), |
1255 (words(( |
1255 (words(( |
1256 'abs', 'acos', 'asin', 'atan', 'ceil', 'char', 'cos', 'floor', |
1256 'abs', 'acos', 'asin', 'atan', 'ceil', 'char', 'cos', 'floor', |
1257 'log', 'round', 'rnd', 'pi', 'sign', 'sin', 'sqrt', 'str', 'tan', |
1257 'log', 'round', 'rnd', 'pi', 'sign', 'sin', 'sqrt', 'str', 'tan', |
1258 'hasIndex', 'indexOf', 'len', 'val', 'code', 'remove', 'lower', |
1258 'hasIndex', 'indexOf', 'len', 'val', 'code', 'remove', 'lower', |
1259 'upper', 'replace', 'split', 'indexes', 'values', 'join', 'sum', |
1259 'upper', 'replace', 'split', 'indexes', 'values', 'join', 'sum', |
1260 'sort', 'shuffle', 'push', 'pop', 'pull', 'range', |
1260 'sort', 'shuffle', 'push', 'pop', 'pull', 'range', |
1261 'print', 'input', 'time', 'wait', 'locals', 'globals', 'outer', |
1261 'print', 'input', 'time', 'wait', 'locals', 'globals', 'outer', |
1262 'yield'), suffix=r'\b'), |
1262 'yield'), suffix=r'\b'), |
1263 Name.Builtin), |
1263 Name.Builtin), |
1264 (r'(true|false|null)\b', Keyword.Constant), |
1264 (r'(true|false|null)\b', Keyword.Constant), |
1265 (r'(and|or|not|new)\b', Operator.Word), |
1265 (r'(and|or|not|new)\b', Operator.Word), |
1266 (r'(self|super|__isa)\b', Name.Builtin.Pseudo), |
1266 (r'(self|super|__isa)\b', Name.Builtin.Pseudo), |
1267 (r'[a-zA-Z_]\w*', Name.Variable) |
1267 (r'[a-zA-Z_]\w*', Name.Variable) |