Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Update the color for logical operators to match BigQuery keywords (#1305
Browse files Browse the repository at this point in the history
)

This PR updates the color for BigQuery logical operators to match the color for BigQuery keywords when using `%bq query` in a cell.

Also updated the order of the keywords to match the docs .
  • Loading branch information
parthea authored and yebrahim committed Apr 7, 2017
1 parent 75a0fb8 commit 8597de6
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions sources/web/datalab/static/codemirror/mode/bigquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ define(
* https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical
*/
var bq_keywords = [
'ALL', 'ANY', 'AS', 'ASC', 'ASSERT_ROWS_MODIFIED', 'AT', 'BETWEEN', 'BY', 'CASE', 'CAST',
'COLLATE', 'CONTAINS', 'CREATE', 'CROSS', 'CUBE', 'CURRENT', 'DELETE', 'DEFAULT', 'DEFINE',
'ALL', 'AND', 'ANY', 'AS', 'ASC', 'ASSERT_ROWS_MODIFIED', 'AT', 'BETWEEN', 'BY', 'CASE', 'CAST',
'COLLATE', 'CONTAINS', 'CREATE', 'CROSS', 'CUBE', 'CURRENT', 'DEFAULT', 'DEFINE', 'DELETE',
'DESC', 'DISTINCT', 'ELSE', 'END', 'ENUM', 'ESCAPE', 'EXCEPT', 'EXCLUDE', 'EXISTS',
'EXTRACT', 'FALSE', 'FETCH', 'FOLLOWING', 'FOR', 'FROM', 'FULL', 'GROUP', 'GROUPING',
'GROUPS', 'HASH', 'HAVING', 'IF', 'IGNORE', 'IN', 'INNER', 'INSERT', 'INTERSECT', 'INTERVAL',
'INTO', 'JOIN', 'LATERAL', 'LEFT', 'LIMIT', 'LOOKUP', 'NATURAL', 'NEW', 'NULL', 'MERGE',
'NO', 'NULLS', 'OF', 'ON', 'ORDER', 'OUTER', 'OVER', 'PARTITION', 'PRECEDING', 'PROTO',
'RANGE', 'RECURSIVE', 'RESPECT', 'RIGHT', 'ROLLUP', 'ROWS', 'SELECT', 'SET', 'SOME',
'TABLESAMPLE', 'THEN', 'TO', 'TREAT', 'TRUE', 'UNBOUNDED', 'UNION', 'UNNEST', 'UPDATE',
'USING', 'WHEN', 'WHERE', 'WINDOW', 'WITH', 'WITHIN'
'INTO', 'IS', 'JOIN', 'LATERAL', 'LEFT', 'LIKE', 'LIMIT', 'LOOKUP', 'MERGE', 'NATURAL', 'NEW',
'NO', 'NOT', 'NULL', 'NULLS', 'OF', 'ON', 'OR', 'ORDER', 'OUTER', 'OVER', 'PARTITION',
'PRECEDING', 'PROTO', 'RANGE', 'RECURSIVE', 'RESPECT', 'RIGHT', 'ROLLUP', 'ROWS', 'SELECT',
'SET', 'SOME', 'TABLESAMPLE', 'THEN', 'TO', 'TREAT', 'TRUE', 'UNBOUNDED', 'UNION', 'UNNEST',
'UPDATE', 'USING', 'WHEN', 'WHERE', 'WINDOW', 'WITH', 'WITHIN'
];

/*
Expand Down Expand Up @@ -73,9 +73,6 @@ define(
];

var bq_operatorChars = /[.~^!<>*+=&|\\-]/;
var bq_operatorWords = [
'NOT', 'LIKE', 'IS', 'AND', 'OR'
];

var bq_punctuationChars = /[{}\(\),;\[\]]/;

Expand All @@ -90,7 +87,6 @@ define(
keywords = wordRegexp(bq_keywords);
functions = wordRegexp(bq_functions);
types = wordRegexp(bq_types);
operatorWords = wordRegexp(bq_operatorWords);

function tokenBase(stream, state) {
var ch = stream.next();
Expand Down Expand Up @@ -129,8 +125,6 @@ define(
return 'keyword';
else if (types.test(word))
return 'type';
else if (operatorWords.test(word))
return 'operator';
else
return 'variable';
}
Expand Down Expand Up @@ -247,7 +241,6 @@ define(
keywords: bq_keywords,
functions: bq_functions,
types: bq_types,
operatorWords: bq_operatorWords,
operatorChars: bq_operatorChars
};
});
Expand Down

0 comments on commit 8597de6

Please sign in to comment.