Skip to content

Commit

Permalink
Added N1QL language support (#1620)
Browse files Browse the repository at this point in the history
Adds support for[N1QL](https://www.couchbase.com/products/n1ql) for Couchbase.
  • Loading branch information
TMWilds authored and RunDevelopment committed Jan 3, 2019
1 parent efdd96c commit 7def8f5
Show file tree
Hide file tree
Showing 16 changed files with 891 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@
"title": "Monkey",
"owner": "Golmote"
},
"n1ql": {
"title": "N1QL",
"owner": "TMWilds"
},
"n4js": {
"title": "N4JS",
"require": "javascript",
Expand Down
18 changes: 18 additions & 0 deletions components/prism-n1ql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/prism-n1ql.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions examples/prism-n1ql.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<h2>Comments</h2>
<pre><code># /* Multi-line
comment */</code></pre>

<h2>Strings</h2>
<pre><code>"foo \"bar\" baz"
'foo \'bar\' baz'
"Multi-line strings
are supported"
'Multi-line strings
are supported'</code></pre>

<h2>Parameters</h2>
<pre><code> $1 $2 $3 </code></pre>

<h2>Operators</h2>
<pre><code>SELECT 1 AND 1;
SELECT 1 OR NULL;
SELECT EXISTS 1;
SELECT 2 BETWEEN 1 AND 3;</code></pre>

<h2>Functions and keywords</h2>
<pre><code>SELECT COUNT(*) AS total, MAX(foo) AS max_foo
FROM `my_bucket`
WHERE `foo` IS NOT NULL;
CREATE INDEX productName_index1 ON bucket_name(productName, ProductID)
WHERE type="product" USING GSI
WITH {"nodes":["node1:8091", "node2:8091", "node3:8091"]};</code></pre>

<h2>Identifiers</h2>
<pre><code>SELECT *
FROM `my_bucket`;
</code></pre>
2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (!Prism.plugins.toolbar) {
}

// The languages map is built automatically with gulp
var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","arff":"ARFF","asciidoc":"AsciiDoc","asm6502":"6502 Assembly","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","autoit":"AutoIt","shell":"Shell","basic":"BASIC","csharp":"C#","cpp":"C++","cil":"CIL","coffeescript":"CoffeeScript","csp":"Content-Security-Policy","css-extras":"CSS Extras","django":"Django/Jinja2","erb":"ERB","fsharp":"F#","gcode":"G-code","gedcom":"GEDCOM","glsl":"GLSL","gml":"GameMaker Language","graphql":"GraphQL","hcl":"HCL","http":"HTTP","hpkp":"HTTP Public-Key-Pins","hsts":"HTTP Strict-Transport-Security","ichigojam":"IchigoJam","inform7":"Inform 7","javastacktrace":"Java stack trace","json":"JSON","jsonp":"JSONP","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","markup-templating":"Markup templating","matlab":"MATLAB","mel":"MEL","n4js":"N4JS","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","opencl":"OpenCL","parigp":"PARI/GP","objectpascal":"Object Pascal","php":"PHP","php-extras":"PHP Extras","plsql":"PL/SQL","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","q":"Q (kdb+ database)","jsx":"React JSX","tsx":"React TSX","renpy":"Ren'py","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","soy":"Soy (Closure Template)","tap":"TAP","toml":"TOML","tt2":"Template Toolkit 2","typescript":"TypeScript","vbnet":"VB.Net","vhdl":"VHDL","vim":"vim","visual-basic":"Visual Basic","wasm":"WebAssembly","wiki":"Wiki markup","xeoracube":"XeoraCube","xojo":"Xojo (REALbasic)","xquery":"XQuery","yaml":"YAML"}/*]*/;
var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","arff":"ARFF","asciidoc":"AsciiDoc","asm6502":"6502 Assembly","aspnet":"ASP.NET (C#)","autohotkey":"AutoHotkey","autoit":"AutoIt","shell":"Shell","basic":"BASIC","csharp":"C#","cpp":"C++","cil":"CIL","coffeescript":"CoffeeScript","csp":"Content-Security-Policy","css-extras":"CSS Extras","django":"Django/Jinja2","erb":"ERB","fsharp":"F#","gcode":"G-code","gedcom":"GEDCOM","glsl":"GLSL","gml":"GameMaker Language","graphql":"GraphQL","hcl":"HCL","http":"HTTP","hpkp":"HTTP Public-Key-Pins","hsts":"HTTP Strict-Transport-Security","ichigojam":"IchigoJam","inform7":"Inform 7","javastacktrace":"Java stack trace","json":"JSON","jsonp":"JSONP","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","markup-templating":"Markup templating","matlab":"MATLAB","mel":"MEL","n1ql":"N1QL","n4js":"N4JS","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","opencl":"OpenCL","parigp":"PARI/GP","objectpascal":"Object Pascal","php":"PHP","php-extras":"PHP Extras","plsql":"PL/SQL","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","q":"Q (kdb+ database)","jsx":"React JSX","tsx":"React TSX","renpy":"Ren'py","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","soy":"Soy (Closure Template)","tap":"TAP","toml":"TOML","tt2":"Template Toolkit 2","typescript":"TypeScript","vbnet":"VB.Net","vhdl":"VHDL","vim":"vim","visual-basic":"Visual Basic","wasm":"WebAssembly","wiki":"Wiki markup","xeoracube":"XeoraCube","xojo":"Xojo (REALbasic)","xquery":"XQuery","yaml":"YAML"}/*]*/;
Prism.plugins.toolbar.registerButton('show-language', function(env) {
var pre = env.element.parentNode;
if (!pre || !/pre/i.test(pre.nodeName)) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions tests/languages/n1ql/boolean_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
TRUE
FALSE


----------------------------------------------------

[
["boolean", "TRUE"],
["boolean", "FALSE"]
]

----------------------------------------------------

Checks for booleans.
14 changes: 14 additions & 0 deletions tests/languages/n1ql/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**/
/* foo
bar */

----------------------------------------------------

[
["comment", "/**/"],
["comment", "/* foo\r\nbar */"]
]

----------------------------------------------------

Checks for comments.
Loading

0 comments on commit 7def8f5

Please sign in to comment.