summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2010-05-08 00:38:17 +0200
committerPatrick Simianer <p@simianer.de>2010-05-08 00:38:17 +0200
commit28fa5c6f101643212dd5a712da0b51167fa082dc (patch)
tree6c7e4a003ea12aa3aa06db2255ab19dbe177df8d
some work done...
-rw-r--r--javascripts/;32
-rw-r--r--javascripts/RegexVis.js77
-rw-r--r--javascripts/init.js2
-rw-r--r--regexvis.html23
-rw-r--r--resources/RegExSource.zipbin0 -> 8691 bytes
-rw-r--r--stylesheets/RegexVis.css0
6 files changed, 134 insertions, 0 deletions
diff --git a/javascripts/; b/javascripts/;
new file mode 100644
index 0000000..958b6fd
--- /dev/null
+++ b/javascripts/;
@@ -0,0 +1,32 @@
+function RegexParser(str) {
+ this.str = str;
+}
+
+RegexParser.prototype.parse = function() {
+ for (var i = 0; i < this.str.length; i++) {
+ switch(this.str[i]) {
+ case '(':
+ break;
+ case '|':
+ break;
+ case ')':
+ break
+ case '*':
+ break
+
+ default:
+ //alert(this.str[i]);
+ }
+ };
+}
+
+
+function State() {
+
+}
+
+function Nfa {
+
+}
+
+
diff --git a/javascripts/RegexVis.js b/javascripts/RegexVis.js
new file mode 100644
index 0000000..c14f52f
--- /dev/null
+++ b/javascripts/RegexVis.js
@@ -0,0 +1,77 @@
+/*
+ * RegexParser
+ *
+ */
+function RegexParser(str) {
+ this.str = str;
+}
+
+RegexParser.prototype.parse = function() {
+ for (var i = 0; i < this.str.length; i++) {
+ switch(this.str[i]) {
+ case '(':
+ break;
+ case '|':
+ break;
+ case ')':
+ break
+ case '*':
+ break
+
+ default:
+ //alert(this.str[i]);
+ }
+ };
+}
+
+
+/*
+ * State
+ *
+ */
+function State(symbol) {
+ if(!symbol) {
+ symbol = '#';
+ }
+ this.symbol = symbol;
+ this.followUps = [];
+ this.marked = false;
+}
+
+State.prototype.mark = function(b) {
+ this.marked = b;
+}
+
+State.prototype.setFollowUp = function(index, state) {
+ if (!((index == 0) || (index==1)) ) return;
+ this.followUps[index] = state;
+}
+
+
+/*
+ * Nfa
+ *
+ */
+function Nfa(symbol) {
+ this.startState;
+ this.endState;
+ if (symbol) {
+ this.startState = new State(symbol);
+ this.endState = new State(false);
+ this.startState.setFollowUp(0, this.endState);
+ }
+}
+
+Nfa.prototype.concatination = function(nfa) {
+ this.endState.setFollowUp(0, nfa);
+ this.endState = nfa.endState;
+}
+
+Nfa.prototype.union = function(nfa) {
+ var s0 = new State();
+ var s1 = new State();
+
+ s0.setFollowUp(0, );
+ s1.setFollowUp(1, );
+}
+
diff --git a/javascripts/init.js b/javascripts/init.js
new file mode 100644
index 0000000..d405f2c
--- /dev/null
+++ b/javascripts/init.js
@@ -0,0 +1,2 @@
+var a = new RegexParser('(a|b)*');
+a.parse();
diff --git a/regexvis.html b/regexvis.html
new file mode 100644
index 0000000..f68ac53
--- /dev/null
+++ b/regexvis.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <!-- 2010-05-07 -->
+ <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
+ <meta http-equiv='Content-Language' content='de_DE' />
+ <meta name='author' content='Patrick Simianer' />
+
+ <title>RegexVis</title>
+
+ <link rel='stylesheet' type='text/css' href='stylesheets/RegexVis.css' />
+
+ <script type='text/javascript' src='javascripts/RegexVis.js'></script>
+ <script type='text/javascript' src='javascripts/init.js'></script>
+</head>
+
+<body>
+
+
+
+</body>
+</html>
+
diff --git a/resources/RegExSource.zip b/resources/RegExSource.zip
new file mode 100644
index 0000000..6171e3d
--- /dev/null
+++ b/resources/RegExSource.zip
Binary files differ
diff --git a/stylesheets/RegexVis.css b/stylesheets/RegexVis.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/stylesheets/RegexVis.css