From abd5da4e44f2ec1643a083e85be328d18197b4a9 Mon Sep 17 00:00:00 2001 From: Prashant Vaibhav Date: Sat, 15 May 2021 11:23:56 +0200 Subject: [PATCH] Recognize clause heads not starting at the beginning of a line When multiple clauses are written on the same line, e.g.: father(mary, sam). father(june, sam). The syntax highlight was only recognising the first clause. The second one had to be placed on the next line. This change allows clauses on the same line to be highlighted correctly. --- .vscode/tasks.json | 33 +++++++++++++++++++++++------ syntaxes/prolog.ecl.tmLanguage.json | 2 +- syntaxes/prolog.ecl.tmLanguage.yaml | 2 +- syntaxes/prolog.swi.tmLanguage.json | 2 +- syntaxes/prolog.swi.tmLanguage.yaml | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 27e659c..a2b3e85 100755 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,23 +7,42 @@ // ${cwd}: the current working directory of the spawned process // A task runner that calls a custom npm script that compiles the extension. { - "version": "0.1.0", - "isShellCommand": true, + "version": "2.0.0", "command": "npm", "args": [ "run" ], "isBackground": true, - "showOutput": "always", - "tasks": [{ - "taskName": "compile", + "tasks": [ + { + "label": "compile", + "type": "shell", + "command": "npm", + "args": [ + "run", + "compile" + ], "problemMatcher": "$tsc-watch" }, { - "taskName": "syntax" + "label": "syntax", + "type": "shell", + "command": "npm", + "args": [ + "run", + "syntax" + ], + "problemMatcher": [] }, { - "taskName": "updateVSCProlog" + "label": "updateVSCProlog", + "type": "shell", + "command": "npm", + "args": [ + "run", + "updateVSCProlog" + ], + "problemMatcher": [] } ] } \ No newline at end of file diff --git a/syntaxes/prolog.ecl.tmLanguage.json b/syntaxes/prolog.ecl.tmLanguage.json index 05aea79..3457d8f 100644 --- a/syntaxes/prolog.ecl.tmLanguage.json +++ b/syntaxes/prolog.ecl.tmLanguage.json @@ -47,7 +47,7 @@ }, { "name": "meta.clause.head.prolog", - "begin": "^\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*:-.*)", + "begin": "\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*:-.*)", "beginCaptures": { "1": { "name": "entity.name.function.clause.prolog" diff --git a/syntaxes/prolog.ecl.tmLanguage.yaml b/syntaxes/prolog.ecl.tmLanguage.yaml index 9edd373..622ce0b 100755 --- a/syntaxes/prolog.ecl.tmLanguage.yaml +++ b/syntaxes/prolog.ecl.tmLanguage.yaml @@ -33,7 +33,7 @@ patterns: match: . - name: meta.clause.head.prolog - begin: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*:-.*)' + begin: '\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*:-.*)' beginCaptures: '1': name: entity.name.function.clause.prolog diff --git a/syntaxes/prolog.swi.tmLanguage.json b/syntaxes/prolog.swi.tmLanguage.json index 0f2a70e..a907311 100644 --- a/syntaxes/prolog.swi.tmLanguage.json +++ b/syntaxes/prolog.swi.tmLanguage.json @@ -47,7 +47,7 @@ }, { "name": "meta.clause.head.prolog", - "begin": "^\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*:-.*)", + "begin": "\\s*([a-z][a-zA-Z0-9_]*)(\\(?)(?=.*:-.*)", "beginCaptures": { "1": { "name": "entity.name.function.clause.prolog" diff --git a/syntaxes/prolog.swi.tmLanguage.yaml b/syntaxes/prolog.swi.tmLanguage.yaml index 4c601f2..8a81177 100755 --- a/syntaxes/prolog.swi.tmLanguage.yaml +++ b/syntaxes/prolog.swi.tmLanguage.yaml @@ -54,7 +54,7 @@ patterns: include: '#constants' - name: meta.dcg.head.prolog - begin: '^\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*-->.*)' + begin: '\s*([a-z][a-zA-Z0-9_]*)(\(?)(?=.*-->.*)' beginCaptures: '1': name: entity.name.function.dcg.prolog