diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-15 04:04:10 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-15 04:04:10 +0200 |
commit | 268a80c4684f38f92fd1ec539dd0edc1a2caed94 (patch) | |
tree | e1e8447f95fda4a55a86cf2b48c9541dbfa4e1c2 /javascripts | |
parent | 178caa12ed7c3a8822a163d51bfe691239a713ff (diff) |
pub
Diffstat (limited to 'javascripts')
-rw-r--r-- | javascripts/Nfa.js | 6 | ||||
-rw-r--r-- | javascripts/NfaSimulator.js | 2 | ||||
-rw-r--r-- | javascripts/RegexParser.js | 4 | ||||
-rw-r--r-- | javascripts/globals.js | 2 | ||||
-rw-r--r-- | javascripts/graph.js | 4 | ||||
-rw-r--r-- | javascripts/ui.js | 10 |
6 files changed, 14 insertions, 14 deletions
diff --git a/javascripts/Nfa.js b/javascripts/Nfa.js index eab1d6c..9915407 100644 --- a/javascripts/Nfa.js +++ b/javascripts/Nfa.js @@ -25,7 +25,7 @@ Nfa.prototype.setFinalState = function(s) { this.finalState = s; }; Nfa.prototype.concat = function(nfa) { this.getFinalState().setFollowUp(0, nfa.getStartState()); this.setFinalState(nfa.getFinalState()); - + return this; }; @@ -36,10 +36,10 @@ Nfa.prototype.union = function(nfa) { s.setFollowUp(0, this.getStartState()); s.setFollowUp(1, nfa.getStartState()); - + this.getFinalState().setFollowUp(0, t); nfa.getFinalState().setFollowUp(0, t); - + this.setStartState(s); this.setFinalState(t); diff --git a/javascripts/NfaSimulator.js b/javascripts/NfaSimulator.js index d8ad9a2..6c5379b 100644 --- a/javascripts/NfaSimulator.js +++ b/javascripts/NfaSimulator.js @@ -20,7 +20,7 @@ NfaSimulator.prototype.simulate = function(word) { this.q = new Stack(); this.getStartState().mark(true); this.q.push(this.getStartState()); - word += REDELIMITER; + word += REDELIMITER; for (var i = 0; i < word.length; i++) { accepted = this.epsclosure(); a = word.substring(i, i+1); diff --git a/javascripts/RegexParser.js b/javascripts/RegexParser.js index 63b8558..7e94d9c 100644 --- a/javascripts/RegexParser.js +++ b/javascripts/RegexParser.js @@ -61,7 +61,7 @@ RegexParser.prototype.literal = function() { this.consume(symbol); return new Nfa(symbol); }; - throw("RegexParser.literal(): Expected a letter or '"+EMPTYSYMBOL+"'."); + throw("RegexParser.literal(): Expected a letter or '"+EMPTYSYMBOL+"'."); }; // Atomar expression. @@ -121,7 +121,7 @@ RegexParser.prototype.parse = function(regex) { }; } catch(e) { this.errorMessage = e; - this.errorPosition = regex.length - this.str.length; + this.errorPosition = regex.length - this.str.length; nfa = null; }; return nfa; diff --git a/javascripts/globals.js b/javascripts/globals.js index 3a5a495..ae62682 100644 --- a/javascripts/globals.js +++ b/javascripts/globals.js @@ -1,6 +1,6 @@ // globals var EPSILON = '~'; // internal use, symbol for 'non-symbol' -var NEXTSTATE = 0; // internal use, state indices, begin at 0 +var NEXTSTATE = 0; // internal use, state indices, begin at 0 var STOPSYMBOL = '%'; // internal use, stop symbol var ALPHABET = 'abcd'+STOPSYMBOL; // used alphabet, need to include stop symbol var SPECIALS = '()|*'; // symbol with special meaning in a regex diff --git a/javascripts/graph.js b/javascripts/graph.js index 17dcaaf..961cc5e 100644 --- a/javascripts/graph.js +++ b/javascripts/graph.js @@ -82,7 +82,7 @@ Raphael.fn.connection = function (obj1, obj2, line, bg, strokeColor, symbol, lab // source: http://stackoverflow.com/questions/2627436/svg-animation-along-path-with-raphael -Raphael.fn.circlePath = function(x , y, r) { +Raphael.fn.circlePath = function(x , y, r) { return "M"+x+","+(y-r)+"A"+r+","+r+",0,1,1,"+(x-0.1)+","+(y-r)+" z"; }; @@ -106,7 +106,7 @@ Raphael.fn.aNode = function(x, y, r, isFinal, hasSelfConn, }; // self connection if (hasSelfConn) { - var p1 = co.getPointAtLength(co.getTotalLength()-r/3); + var p1 = co.getPointAtLength(co.getTotalLength()-r/3); var p2 = co.getPointAtLength(r/3); var selfConn = this.path('M'+p1.x+','+p1.y+ ' C'+(p1.x-r)+','+(p1.y-2.5*r)+' '+ diff --git a/javascripts/ui.js b/javascripts/ui.js index d84bf1a..4a94a15 100644 --- a/javascripts/ui.js +++ b/javascripts/ui.js @@ -4,11 +4,11 @@ */ -// initialization of ui +// initialization of ui $(function() { // #alphabet $('#alphabet').html(ALPHABET.substr(0,ALPHABET.length-1)); - // #regex + // #regex $('#regex').change(function() { checkLength(this, "#parseButton"); }); $('#regex').keypress(function(event) { return getKey(event, ALPHABETS); }); $('#regex').mouseout(function() { checkLength(this, "#parseButton"); }); @@ -30,7 +30,7 @@ $(function() { // #descButton $('#descButton').click(function() { $('#desc').toggle(); }); // in place edit of alphabet - $('body').click(function() { + $('body').click(function() { if (alphabetEdit) { ALPHABET = $('#alphabetInput').attr('value').replace(/\s/g,'').replace(/%/g, '').replace(/\*/g, ''); ALPHABET = ALPHABET.replace(/\(/g, '').replace(/\)/g, '').replace(/\|/g, '')+STOPSYMBOL; @@ -176,7 +176,7 @@ function graphMoveByInput(e) { //var w = $('#word').attr('value'); //$('#word').attr('value', w.substr(0, w.length-1)); lock = false; - return false; + return false; } } else { lock = true; @@ -228,7 +228,7 @@ function graphMoveByInput(e) { window.setTimeout(function() { if (!window.gPrevState) return; // none of word left g.mover.animate({cx:gPrevState.node[1][0].cx.baseVal.value, cy:gPrevState.node[1][0].cy.baseVal.value}, 250); - lock = false; + lock = false; }, 250); window.gCurrentState = gPrevState; if (ttable[window.gCurrentState.name].isFinal) { |