Skip to content

Commit

Permalink
[sql mode] Add support.commentHash and support.commentSpaceRequired t…
Browse files Browse the repository at this point in the history
…o support Oracle comments
  • Loading branch information
santec authored and marijnh committed Jun 12, 2013
1 parent cf4f05d commit 0db3c6f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mode/sql/sql.js
Expand Up @@ -51,7 +51,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
} else if (/^[\(\),\;\[\]]/.test(ch)) {
// no highlightning
return null;
} else if (ch == "#" || (ch == "-" && stream.eat("-") && stream.eat(" "))) {
} else if ((support.commentHash && ch == "#")
|| (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) {
// 1-line comments
// ref: https://kb.askmonty.org/en/comment-syntax/
stream.skipToEnd();
Expand Down Expand Up @@ -258,7 +259,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
atoms: set("false true null unknown"),
operatorChars: /^[*+\-%<>!=&|^]/,
dateSQL: set("date time timestamp"),
support: set("ODBCdotTable zerolessFloat nCharCast charsetCast"),
support: set("ODBCdotTable zerolessFloat nCharCast charsetCast commentHash commentSpaceRequired"),
hooks: {
"@": hookVar,
"`": hookIdentifier,
Expand All @@ -274,7 +275,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
atoms: set("false true null unknown"),
operatorChars: /^[*+\-%<>!=&|^]/,
dateSQL: set("date time timestamp"),
support: set("ODBCdotTable zerolessFloat nCharCast charsetCast"),
support: set("ODBCdotTable zerolessFloat nCharCast charsetCast commentHash commentSpaceRequired"),
hooks: {
"@": hookVar,
"`": hookIdentifier,
Expand Down Expand Up @@ -315,6 +316,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
* zerolessFloat: .1
* nCharCast: N'string'
* charsetCast: _utf8'string'
* commentHash: use # char for comments
* commentSpaceRequired: require a space after -- for comments
atoms:
Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others:
UNKNOWN, INFINITY, UNDERFLOW, NaN...
Expand Down

0 comments on commit 0db3c6f

Please sign in to comment.