{ "name": "SWI-Prolog", "scopeName": "source.prolog", "patterns": [ { "include": "#comments" }, { "name": "meta.clause.body.prolog", "begin": "(?\u003c=:-)\\s*", "end": "(\\.)", "patterns": [ { "include": "#comments" }, { "include": "#builtin" }, { "include": "#controlandkeywords" }, { "include": "#atom" }, { "include": "#variable" }, { "include": "#constants" }, { "name": "meta.clause.body.prolog", "match": "." } ], "endCaptures": { "1": { "name": "keyword.control.clause.bodyend.prolog" } } }, { "name": "meta.clause.head.prolog", "begin": "^\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*:-.*)", "end": "((\\)?))\\s*(:-)", "patterns": [ { "include": "#atom" }, { "include": "#variable" }, { "include": "#constants" } ], "beginCaptures": { "1": { "name": "entity.name.function.clause.prolog" }, "2": { "name": "punctuation.definition.parameters.begin" } }, "endCaptures": { "1": { "name": "punctuation.definition.parameters.end" }, "3": { "name": "keyword.control.clause.bodybegin.prolog" } } }, { "name": "meta.dcg.head.prolog", "begin": "^\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*--\u003e.*)", "end": "((\\)?))\\s*(--\u003e)", "patterns": [ { "include": "#atom" }, { "include": "#variable" }, { "include": "#constants" } ], "beginCaptures": { "1": { "name": "entity.name.function.dcg.prolog" }, "2": { "name": "punctuation.definition.parameters.begin" } }, "endCaptures": { "1": { "name": "punctuation.definition.parameters.end" }, "3": { "name": "keyword.control.dcg.bodybegin.prolog" } } }, { "name": "meta.dcg.body.prolog", "begin": "(?\u003c=--\u003e)\\s*", "end": "(\\.)", "patterns": [ { "include": "#comments" }, { "include": "#controlandkeywords" }, { "include": "#atom" }, { "include": "#variable" }, { "include": "#constants" }, { "name": "meta.dcg.body.prolog", "match": "." } ], "endCaptures": { "1": { "name": "keyword.control.dcg.bodyend.prolog" } } }, { "name": "meta.fact.prolog", "begin": "^\\s*([a-zA-Z][a-zA-Z0-9_]*)(\\(?)(?!.*(:-|--\u003e).*)", "end": "((\\)?))\\s*(\\.)(?!\\d+)", "patterns": [ { "include": "#atom" }, { "include": "#variable" }, { "include": "#constants" } ], "beginCaptures": { "1": { "name": "entity.name.function.fact.prolog" }, "2": { "name": "punctuation.definition.parameters.begin" } }, "endCaptures": { "1": { "name": "punctuation.definition.parameters.end" }, "3": { "name": "keyword.control.fact.end.prolog" } } } ], "repository": { "atom": { "patterns": [ { "name": "constant.other.atom.simple.prolog", "match": "(?\u003c![a-zA-Z0-9_])[a-z][a-zA-Z0-9_]*(?!\\s*\\(|[a-zA-Z0-9_])" }, { "name": "constant.other.atom.quoted.prolog", "match": "'.*?'" }, { "name": "constant.other.atom.emptylist.prolog", "match": "\\[\\]" } ] }, "builtin": { "patterns": [ { "name": "keyword.other", "match": "\\b(op|findall|write|nl|writeln|fail|use_module|module)\\b" } ] }, "comments": { "patterns": [ { "name": "comment.line.percent-sign.prolog", "match": "%.*" }, { "name": "comment.block.prolog", "begin": "/\\*", "end": "\\*/", "captures": { "0": { "name": "punctuation.definition.comment.prolog" } } } ] }, "constants": { "patterns": [ { "name": "constant.numeric.integer.prolog", "match": "(?\u003c![a-zA-Z]|/)(\\d+|(\\d+\\.\\d+))" }, { "name": "string.quoted.double.prolog", "match": "\".*?\"" } ] }, "controlandkeywords": { "patterns": [ { "name": "meta.if.prolog", "begin": "(-\u003e)", "end": "(;)", "patterns": [ { "include": "$self" }, { "include": "#builtin" }, { "include": "#comments" }, { "include": "#atom" }, { "include": "#variable" }, { "name": "meta.if.body.prolog", "match": "." } ], "beginCaptures": { "1": { "name": "keyword.control.if.prolog" } }, "endCaptures": { "1": { "name": "keyword.control.else.prolog" } } }, { "name": "keyword.control.cut.prolog", "match": "!" }, { "name": "keyword.operator.prolog", "match": "(\\s(is)\\s)|=:=|=?\\\\?=|\\\\\\+|@?\u003e|@?=?\u003c|\\+|\\*|\\-" } ] }, "variable": { "patterns": [ { "name": "variable.parameter.uppercase.prolog", "match": "(?\u003c![a-zA-Z0-9_])[A-Z][a-zA-Z0-9_]*" }, { "name": "variable.language.anonymous.prolog", "match": "(?\u003c!\\w)_" } ] } } }