From 8e605bf8e8ede356a2611563f9f2158878c849e3 Mon Sep 17 00:00:00 2001 From: Paulo Moura Date: Fri, 3 Aug 2018 14:06:54 +0100 Subject: [PATCH] Update Logtalk language support for highlighting 0'\Char numbers --- src/lang-logtalk.js | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/lang-logtalk.js b/src/lang-logtalk.js index 1e79559a..00f6be47 100644 --- a/src/lang-logtalk.js +++ b/src/lang-logtalk.js @@ -1,24 +1,22 @@ -/** - * @license - * Copyright (C) 2014 Paulo Moura - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright (C) 2014 Paulo Moura +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + /** * @fileoverview * Registers a language handler for Logtalk. - * http://logtalk.org/ + * https://logtalk.org/ * @author Paulo Moura */ @@ -32,7 +30,7 @@ PR['registerLangHandler']( // quoted atoms [PR['PR_LITERAL'], /^\'(?:[^\'\\\n\x0C\r]|\\[^&])+\'?/, null, "'"], // numbers - [PR['PR_LITERAL'], /^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i, null, '0123456789'] + [PR['PR_LITERAL'], /^(?:0'\\.|0'.|0b[0-1]+|0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i, null, '0123456789'] ], [ // single-line comments begin with % @@ -40,8 +38,8 @@ PR['registerLangHandler']( // block comments are delimited by /* and */ [PR['PR_COMMENT'], /^\/\*[\s\S]*?\*\//], // directives - [PR['PR_KEYWORD'], /^\s*:-\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))/], - [PR['PR_KEYWORD'], /^\s*:-\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)/], + [PR['PR_KEYWORD'], /^\s*:-\s(?:category|coinductive|public|protocol|protected|private|elif|encoding|ensure_loaded|export|if|include|initialization|info|imports|alias|dynamic|discontiguous|meta_non_terminal|meta_predicate|mode|module|multifile|reexport|set_logtalk_flag|set_prolog_flag|synchronized|object|op|uses|use_module)\b/], + [PR['PR_KEYWORD'], /^\s*:-\s(?:else|endif|end_category|end_object|end_protocol|built_in|dynamic|threaded)\./], // variables [PR['PR_TYPE'], /^[A-Z_][a-zA-Z0-9_]*/], // operators