Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit dd715f9

Browse files
committed
fixed error reporting when there is more than one statement in the input SQL. still need to make sure previous tree is not used if a following statement has an error at the highest level. some css improvements to the interactive demo, additional names in grammar.pegjs. need to fork pegjs to get the changes to pegjs core into version control so they are not accidentally overwritten. refs #2
1 parent dee97f3 commit dd715f9

File tree

12 files changed

+9561
-10559
lines changed

12 files changed

+9561
-10559
lines changed

Gruntfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = function(grunt) {
99
demo: {
1010
options: {
1111
alias: {
12-
'sqlite-parser': './index.js',
12+
'sqlite-parser': './index',
13+
'sqlite-parser-util': './lib/parser-util',
1314
'codemirror': './node_modules/codemirror/lib/codemirror',
1415
'foldcode': './node_modules/codemirror/addon/fold/foldcode',
1516
'foldgutter': './node_modules/codemirror/addon/fold/foldgutter',

demo/css/demo.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ body {
3838

3939
.right {
4040
border: 1px solid #77A025;
41+
transition: all 0.75s;
4142
}
4243

4344
.right.alert {
@@ -60,6 +61,7 @@ body {
6061
background-color: #daf6a1;
6162
color: #557B0A;
6263
border-bottom: 1px solid #77A025;
64+
transition: all 0.75s;
6365
}
6466

6567
.container .right.alert h3 {
@@ -97,7 +99,7 @@ a, a:visited {
9799
}
98100

99101
a:hover, a:active {
100-
color: #77A025;
102+
color: #FFF7A8;
101103
text-decoration: none;
102104

103105
}

demo/js/demo.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
(function (root) {
22
var sqliteParser = require('sqlite-parser'),
3+
util = require('sqlite-parser-util'),
34
CodeMirror = require('codemirror'),
45
panel = document.getElementById('ast'),
5-
msgArea = document.getElementById('ast-header');
6+
msgArea = document.getElementById('ast-header'),
7+
elemSql = document.getElementById('sql-text'),
8+
elemAst = document.getElementById('ast-text');
69

710
require('foldcode');
811
require('foldgutter');
@@ -67,24 +70,21 @@
6770
}
6871

6972
var loadDemo = function () {
70-
var sql = CodeMirror.fromTextArea(document.getElementById('sql-text'), {
71-
mode: 'text/x-plsql',
73+
var cmDefaults = {
7274
lineNumbers: true,
7375
theme: 'monokai',
74-
tabSize: 4,
7576
lineWrapping: true,
76-
lineWrapping: true
77-
}),
78-
ast = CodeMirror.fromTextArea(document.getElementById('ast-text'), {
79-
lineNumbers: true,
80-
theme: 'monokai',
81-
lineWrapping: true,
82-
mode: "application/ld+json",
8377
tabSize: 4,
84-
lineWrapping: true,
85-
foldGutter: true,
8678
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
87-
}),
79+
},
80+
sql = CodeMirror.fromTextArea(elemSql, util.extend({
81+
mode: 'text/x-plsql'
82+
}, cmDefaults)),
83+
ast = CodeMirror.fromTextArea(elemAst, util.extend({
84+
mode: "application/ld+json",
85+
foldGutter: true,
86+
readOnly: 'nocursor'
87+
}, cmDefaults)),
8888
update = debounce(function () {
8989
updater(sql, ast);
9090
}, 250);

0 commit comments

Comments
 (0)