File modules/editor/codemirror/mode/pegjs/index.html

Last commit: Sun Dec 17 01:14:09 2017 +0100	Jan Dankert	Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 <!doctype html> 2 <html> 3 <head> 4 <title>CodeMirror: PEG.js Mode</title> 5 <meta charset="utf-8"/> 6 <link rel=stylesheet href="../../doc/docs.css"> 7 8 <link rel="stylesheet" href="../../lib/codemirror.css"> 9 <script src="../../lib/codemirror.js"></script> 10 <script src="../javascript/javascript.js"></script> 11 <script src="pegjs.js"></script> 12 <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> 13 </head> 14 <body> 15 <div id=nav> 16 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> 17 18 <ul> 19 <li><a href="../../index.html">Home</a> 20 <li><a href="../../doc/manual.html">Manual</a> 21 <li><a href="https://github.com/codemirror/codemirror">Code</a> 22 </ul> 23 <ul> 24 <li><a href="../index.html">Language modes</a> 25 <li><a class=active href="#">PEG.js Mode</a> 26 </ul> 27 </div> 28 29 <article> 30 <h2>PEG.js Mode</h2> 31 <form><textarea id="code" name="code"> 32 /* 33 * Classic example grammar, which recognizes simple arithmetic expressions like 34 * "2*(3+4)". The parser generated from this grammar then computes their value. 35 */ 36 37 start 38 = additive 39 40 additive 41 = left:multiplicative "+" right:additive { return left + right; } 42 / multiplicative 43 44 multiplicative 45 = left:primary "*" right:multiplicative { return left * right; } 46 / primary 47 48 primary 49 = integer 50 / "(" additive:additive ")" { return additive; } 51 52 integer "integer" 53 = digits:[0-9]+ { return parseInt(digits.join(""), 10); } 54 55 letter = [a-z]+</textarea></form> 56 <script> 57 var editor = CodeMirror.fromTextArea(document.getElementById("code"), { 58 mode: {name: "pegjs"}, 59 lineNumbers: true 60 }); 61 </script> 62 <h3>The PEG.js Mode</h3> 63 <p> Created by Forbes Lindesay.</p> 64 </article> 65 </body> 66 </html>
Download modules/editor/codemirror/mode/pegjs/index.html
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.