-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
176 lines (162 loc) · 5.63 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html>
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-KP21VLGW8F"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-KP21VLGW8F');
</script>
<meta charset="utf-8">
<title>fa-builder</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="built/src/main.js" type="module" defer></script>
</head>
<body>
<h1>fa-builder</h1>
<div id="app-container">
<svg id="canvas" xmlns="http://www.w3.org/2000/svg">
<defs>
<!-- A marker to be used as an arrowhead -->
<marker id="arrow" viewBox="0 0 12 12" refX="10" refY="6" markerWidth="6" markerHeight="6"
orient="auto-start-reverse">
<path d="M 0 0 L 12 6 L 0 12 z" />
</marker>
</defs>
<g id="state-layer"></g>
<g id="edge-layer"></g>
<g id="top-layer"></g>
</svg>
<div id="add-state" class="statelike">Drag me!</div>
<div id="config-menu-container" class="none">
<form id="trans-config">
<h2>Transition configuration</h2>
<p>
<label for="trans-char">Transition character:</label>
<input id="trans-char">
</p>
<p>
<input type="checkbox" id="epsilon-trans">
<label for="epsilon-trans">Epsilon transition</label>
</p>
<fieldset>
<legend>Edge type</legend>
<input type="radio" id="line-choice" name="arrow-type" value="line">
<label for="line-choice">Line</label>
<input type="radio" id="bezier-choice" name="arrow-type" value="bezier">
<label for="bezier-choice">Bezier curve</label>
<p id="line-options">
<input type="checkbox" id="shortest-line">
<label for="shortest-line">Shortest line</label>
</p>
</fieldset>
<p>
<button id="reverse-edge">Reverse Text Side</button>
</p>
</form>
<form id="state-config">
<h2>State configuration</h2>
<p>
<label for="state-name">State name:</label>
<input id="state-name">
</p>
<p>
<input type="checkbox" id="starting">
<label for="starting">Starting state</label>
</p>
<p>
<input type="checkbox" id="accepting">
<label for="accepting">Accepting state</label>
</p>
</form>
<p id="mult-warning">
Multiple elements selected.
</p>
<p id="common-menu">
<button type="button" id="delete">Delete</button>
</p>
<p id="config-menu-hint">
Drag and select something on the canvas to view configuration options.
</p>
</div>
<div id="global-menu-container">
<button id="save">Save Canvas</button>
<button id="load">Load Canvas</button>
<button id="export">Export SVG</button>
<a href="#help">Help</a>
</div>
<div id="analysis-container">
<h2>Analysis</h2>
<p id="analysis-error"></p>
<p>Equivalent regex: <code id="regex-output"></code></p>
</div>
</div>
<h2 id="help">Help</h2>
<h3>States</h3>
<p>
Drag the circle labeled "Drag me!" onto the rectangular canvas to add a
state. You can move states around by dragging them. Select a state to
change its name, accepting status, or starting state status. You can also
double-click on a state to toggle its accepting status.
</p>
<h3>Transitions</h3>
<p>
Start dragging from any state on the canvas with your secondary mouse
button and an arrow will appear. Drop the arrow onto any state to create a
transition (if you drop it on the same state, this creates a self loop).
</p>
<p>
Select an edge to change its arrow type and transition character. When you
select an edge whose arrow type is not shortest line, there will appear
pink circles (control points) that you can drag to change the curvature of
the arrow.
</p>
<p>
If the transition label is upside-down, you can select the edge and click
"Reverse Text Side" to reverse it.
</p>
<p>
As of now, epsilon transitions are not supported.
</p>
<h3>Selecting elements</h3>
<p>
Start dragging on an empty part of the canvas (i.e. not on a state) to
start a selection. As you drag, any elements that come in contact with the
selection rectangle will be highlighted. Drop to end the selection, and the
menu on the right will display further actions on the selected elements.
</p>
<h3>Analysis</h3>
<p>
The analysis panel on the bottom displays information about your DFA as you
edit. More features coming soon!
</p>
<h4>Equivalent regex</h4>
<p>
This field displays a regular expression that is equivalent to your DFA.
The syntax is as follows:
</p>
<dl id="help-regex">
<dt><code>abc</code></dt>
<dd>Character sequences match themselves.</dd>
<dt><code>(abc)</code></dt>
<dd>Parentheses create groups and are used to clarify precedence.</dd>
<dt><code>ab*c</code></dt>
<dd>
A character/group followed by an asterisk matches any number
(including none) of that character/group. This example would match
<code>ac</code>, <code>abc</code>, or <code>abbbc</code>.
</dd>
<dt><code>abc|def</code></dt>
<dd>
Sequences/groups separated by pipes match either sequence/group.
</dd>
<dt><code>[abc]</code></dt>
<dd>
Square brackets create optional groups. This example is equivalent to
<code>(ε|abc)</code> where <code>ε</code> is the empty string.
</dd>
</dl>
</body>
</html>