[gtksourceview/gtksourceview-4-6] javascript.lang: Fix comments not allowed in post-primary-expression
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/gtksourceview-4-6] javascript.lang: Fix comments not allowed in post-primary-expression
- Date: Thu, 9 Apr 2020 20:21:10 +0000 (UTC)
commit 68eff2fdc5141fdd9a483ff26897dbcf357879ab
Author: Jeffery To <jeffery to gmail com>
Date: Wed Apr 8 17:19:10 2020 +0800
javascript.lang: Fix comments not allowed in post-primary-expression
Fixes #122.
data/language-specs/javascript-expressions.lang | 1 +
tests/syntax-highlighting/file.j | 14 ++++++++------
tests/syntax-highlighting/file.js | 14 ++++++++------
tests/syntax-highlighting/file.jsx | 14 ++++++++------
tests/syntax-highlighting/file.ts | 14 ++++++++------
tests/syntax-highlighting/file.tsx | 14 ++++++++------
6 files changed, 41 insertions(+), 30 deletions(-)
---
diff --git a/data/language-specs/javascript-expressions.lang b/data/language-specs/javascript-expressions.lang
index dd184825..5527741f 100644
--- a/data/language-specs/javascript-expressions.lang
+++ b/data/language-specs/javascript-expressions.lang
@@ -316,6 +316,7 @@
<context id="_post-primary-expression">
<include>
<context ref="js:embedded-lang-hooks"/>
+ <context ref="js:comments"/>
<!-- <MemberExpression> (part of) -->
<context id="_dot-property-accessors">
diff --git a/tests/syntax-highlighting/file.j b/tests/syntax-highlighting/file.j
index 8c95c70c..44e23f3b 100644
--- a/tests/syntax-highlighting/file.j
+++ b/tests/syntax-highlighting/file.j
@@ -799,17 +799,19 @@ a = class extends Bar {
// Dot notation
arr.length;
-obj
- . prototype
- . extends;
+( obj
+ . /* comment */ prototype /* comment */
+ . /* comment */ constructor /* comment */
+);
const pi = Math.PI
const num = 0
// Bracket notation
arr['length'];
-obj
- ['prototype']
- ['constructor'];
+( obj
+ /* comment */ [ /* comment */ 'prototype' /* comment */ ] /* comment */
+ /* comment */ [ /* comment */ 'constructor' /* comment */ ] /* comment */
+);
// Mixed
obj
diff --git a/tests/syntax-highlighting/file.js b/tests/syntax-highlighting/file.js
index f3a2ec69..2239bf4f 100644
--- a/tests/syntax-highlighting/file.js
+++ b/tests/syntax-highlighting/file.js
@@ -498,17 +498,19 @@ a = class extends Bar {
// Dot notation
arr.length;
-obj
- . prototype
- . extends;
+( obj
+ . /* comment */ prototype /* comment */
+ . /* comment */ constructor /* comment */
+);
const pi = Math.PI
const num = 0
// Bracket notation
arr['length'];
-obj
- ['prototype']
- ['constructor'];
+( obj
+ /* comment */ [ /* comment */ 'prototype' /* comment */ ] /* comment */
+ /* comment */ [ /* comment */ 'constructor' /* comment */ ] /* comment */
+);
// Mixed
obj
diff --git a/tests/syntax-highlighting/file.jsx b/tests/syntax-highlighting/file.jsx
index a774d169..289f0bdf 100644
--- a/tests/syntax-highlighting/file.jsx
+++ b/tests/syntax-highlighting/file.jsx
@@ -555,17 +555,19 @@ a = class extends Bar {
// Dot notation
arr.length;
-obj
- . prototype
- . extends;
+( obj
+ . /* comment */ prototype /* comment */
+ . /* comment */ constructor /* comment */
+);
const pi = Math.PI
const num = 0
// Bracket notation
arr['length'];
-obj
- ['prototype']
- ['constructor'];
+( obj
+ /* comment */ [ /* comment */ 'prototype' /* comment */ ] /* comment */
+ /* comment */ [ /* comment */ 'constructor' /* comment */ ] /* comment */
+);
// Mixed
obj
diff --git a/tests/syntax-highlighting/file.ts b/tests/syntax-highlighting/file.ts
index 548cd73f..cb87b65e 100644
--- a/tests/syntax-highlighting/file.ts
+++ b/tests/syntax-highlighting/file.ts
@@ -1092,17 +1092,19 @@ a = class extends Bar {
// Dot notation
arr.length;
-obj
- . prototype
- . extends;
+( obj
+ . /* comment */ prototype /* comment */
+ . /* comment */ constructor /* comment */
+);
const pi = Math.PI
const num = 0
// Bracket notation
arr['length'];
-obj
- ['prototype']
- ['constructor'];
+( obj
+ /* comment */ [ /* comment */ 'prototype' /* comment */ ] /* comment */
+ /* comment */ [ /* comment */ 'constructor' /* comment */ ] /* comment */
+);
// Mixed
obj
diff --git a/tests/syntax-highlighting/file.tsx b/tests/syntax-highlighting/file.tsx
index b5bf97a1..84387a96 100644
--- a/tests/syntax-highlighting/file.tsx
+++ b/tests/syntax-highlighting/file.tsx
@@ -1200,17 +1200,19 @@ a = class extends Bar {
// Dot notation
arr.length;
-obj
- . prototype
- . extends;
+( obj
+ . /* comment */ prototype /* comment */
+ . /* comment */ constructor /* comment */
+);
const pi = Math.PI
const num = 0
// Bracket notation
arr['length'];
-obj
- ['prototype']
- ['constructor'];
+( obj
+ /* comment */ [ /* comment */ 'prototype' /* comment */ ] /* comment */
+ /* comment */ [ /* comment */ 'constructor' /* comment */ ] /* comment */
+);
// Mixed
obj
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]