262 lines
7.2 KiB
Plaintext
262 lines
7.2 KiB
Plaintext
// Python
|
|
(
|
|
|
|
/****************************************************************************/
|
|
// MARK: Python keywords
|
|
/****************************************************************************/
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.identifier";
|
|
Syntax = {
|
|
StartChars = "abcdefghijklmnopqrstuvwxyz";
|
|
Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
|
|
Words = (
|
|
"and",
|
|
"as",
|
|
"assert",
|
|
"break",
|
|
"class",
|
|
"continue",
|
|
"def",
|
|
"del",
|
|
"elif",
|
|
"else",
|
|
"except",
|
|
"exec",
|
|
"finally",
|
|
"for",
|
|
"from",
|
|
"global",
|
|
"if",
|
|
"import",
|
|
"in",
|
|
"is",
|
|
"lambda",
|
|
"not",
|
|
"or",
|
|
"pass",
|
|
"print",
|
|
"raise",
|
|
"return",
|
|
"try",
|
|
"while",
|
|
"with",
|
|
"yield",
|
|
"None",
|
|
);
|
|
Type = "xcode.syntax.keyword";
|
|
AltType = "xcode.syntax.identifier"; // non-keywords are identifiers
|
|
};
|
|
},
|
|
|
|
|
|
/****************************************************************************/
|
|
// MARK: Python Syntax Coloring
|
|
/****************************************************************************/
|
|
|
|
{
|
|
Identifier = "xcode.lang.python";
|
|
Description = "Python Coloring";
|
|
BasedOn = "xcode.lang.simpleColoring";
|
|
IncludeInMenu = YES;
|
|
Name = "Prolog";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.prolog.lexer";
|
|
IncludeRules = (
|
|
"xcode.lang.prolog.fact",
|
|
"xcode.lang.prolog.rule",
|
|
"xcode.lang.prolog.dcg",
|
|
"xcode.lang.prolog.directive",
|
|
);
|
|
Type = "xcode.syntax.plain";
|
|
DirtyPreviousRightEdge = YES;
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.[prolog].lexer";
|
|
Syntax = {
|
|
SourceScannerClassName = "XCPrologner"; // does the magical indentation parsing
|
|
IncludeRules = (
|
|
"xcode.lang.comment.singleline.percent",
|
|
"xcode.lang.python.string.backquote",
|
|
"xcode.lang.python.string.singlequote",
|
|
"xcode.lang.string",
|
|
"xcode.lang.character",
|
|
"xcode.lang.number",
|
|
"xcode.lang.prolog.identifier",
|
|
"xcode.lang.prolog.constant",
|
|
);
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
|
|
// declare "fake" tokens for XCPrologScanner to return
|
|
{
|
|
Identifier = "xcode.lang.prolog.indent";
|
|
Syntax = {
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
{
|
|
Identifier = "xcode.lang.prolog.dedent";
|
|
Syntax = {
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
|
|
{
|
|
// ignores indentation
|
|
Identifier = "xcode.lang.prolog.lexer.simple";
|
|
Syntax = {
|
|
IncludeRules = (
|
|
"xcode.lang.comment.singleline.pound",
|
|
"xcode.lang.python.string.tripledoublequote",
|
|
"xcode.lang.python.string.triplesinglequote",
|
|
"xcode.lang.string",
|
|
"xcode.lang.character",
|
|
"xcode.lang.number",
|
|
"xcode.lang.python.identifier",
|
|
);
|
|
Type = "xcode.syntax.plain";
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.python.class";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.python.lexer";
|
|
Rules = (
|
|
"xcode.lang.python.class.declarator",
|
|
"xcode.lang.python.block",
|
|
);
|
|
Type = "xcode.syntax.definition.class";
|
|
};
|
|
},
|
|
{
|
|
Identifier = "xcode.lang.python.class.declarator";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.python.lexer";
|
|
Rules = (
|
|
"class",
|
|
"xcode.lang.python.name",
|
|
"xcode.lang.python.parenexpr?",
|
|
":",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.python.function";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.python.lexer";
|
|
Rules = (
|
|
"xcode.lang.python.function.declarator",
|
|
"xcode.lang.python.block",
|
|
);
|
|
Type = "xcode.syntax.definition.function";
|
|
};
|
|
},
|
|
{
|
|
Identifier = "xcode.lang.python.function.declarator";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.python.lexer";
|
|
Rules = (
|
|
"def",
|
|
"xcode.lang.python.name",
|
|
"xcode.lang.python.parenexpr",
|
|
":",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.python.block";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.python.lexer";
|
|
Start = "xcode.lang.python.indent";
|
|
End = "xcode.lang.python.dedent";
|
|
Foldable = YES;
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.python.class",
|
|
"xcode.lang.python.function",
|
|
"xcode.lang.python.bracketexpr",
|
|
"xcode.lang.python.parenexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.name";
|
|
Syntax = {
|
|
StartChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEF";
|
|
Chars = "0123456789abcdefABCDEF";
|
|
Type = "xcode.syntax.name.partial";
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.python.string.backquote";
|
|
Syntax = {
|
|
Start = "`";
|
|
End = "`";
|
|
Foldable = YES;
|
|
Type = "xcode.syntax.string";
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.string.singlequote";
|
|
Syntax = {
|
|
Start = "'";
|
|
EscapeChar = "\'";
|
|
End = "'";
|
|
Foldable = YES;
|
|
Type = "xcode.syntax.string";
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.parenexpr";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.prolog.lexer.simple";
|
|
Start = "(";
|
|
End = ")";
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.prolog.bracketexpr",
|
|
"xcode.lang.prolog.curlybracketexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.bracketexpr";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.prolog.lexer.simple";
|
|
Start = "[";
|
|
End = "]";
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.prolog.parenexpr",
|
|
"xcode.lang.prolog.curlybracketexpr",
|
|
);
|
|
};
|
|
},
|
|
|
|
{
|
|
Identifier = "xcode.lang.prolog.curlybracketexpr";
|
|
Syntax = {
|
|
Tokenizer = "xcode.lang.prolog.lexer.simple";
|
|
Start = "{";
|
|
End = "}";
|
|
Recursive = YES;
|
|
IncludeRules = (
|
|
"xcode.lang.prolog.parenexpr",
|
|
"xcode.lang.prolog.bracketexpr",
|
|
);
|
|
};
|
|
},
|
|
)
|