diff --git a/articles/text_editors_with_contenteditable.article.html b/articles/text_editors_with_contenteditable.article.html index 946d156..2fb46d9 100644 --- a/articles/text_editors_with_contenteditable.article.html +++ b/articles/text_editors_with_contenteditable.article.html @@ -1,4 +1,30 @@

I've been playing with an exciting feature of HTML5 that I hadn't heard of: the contentEditable attribute. It's magical! It just makes anything suddenly be editable in-browser! It also finally provides me with the thing I've been wanting ever since growing dissatisfied with text editors: A way to build a new text editor, without having to actually code up the guts of text movement, manipulation, and entry. Oh, happy day!

More on this as the situation progresses.

-
\ No newline at end of file +/* + * This is my parser. + * It's not much, but it's mine. + */ + +blocks = code:(if_block / lines)* { return code; } + +if_block = + "if" ws "(" cond:string ")" ws "{" result:lines "}" + { return {type: "if", condition: cond, body: result }; } + +/* +while_block = "while" ws "(" cond:string ")" ws "{" result:lines "}" + { return {type: "while", condition: cond, body: result }; } +*/ + +lines = lines:line+ ws? + { return lines; } + +line = ws? contents:string ";" + { return contents; } + +ws = (" " / "\n")+ { return ""; } + +string = characters:([A-Za-z]+ [A-Za-z ]*) { return characters.join(""); } + + diff --git a/static/text_editor.html b/static/text_editor.html index 7a189f2..f54b9a4 100644 --- a/static/text_editor.html +++ b/static/text_editor.html @@ -94,17 +94,17 @@ When I see the text "if (something)", then I should make a new if block.