Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Unified Diff: packages/petitparser/example/lispweb/lispweb.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/petitparser/example/lispweb/lispweb.css ('k') | packages/petitparser/example/lispweb/lispweb.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/petitparser/example/lispweb/lispweb.dart
diff --git a/packages/petitparser/example/lispweb/lispweb.dart b/packages/petitparser/example/lispweb/lispweb.dart
new file mode 100644
index 0000000000000000000000000000000000000000..32e25ab325459f4ae4d3ca226726aef7b20b5914
--- /dev/null
+++ b/packages/petitparser/example/lispweb/lispweb.dart
@@ -0,0 +1,35 @@
+library petitparser.example.lispweb;
+
+import 'dart:html';
+import 'package:petitparser/lisp.dart';
+
+void inspector(Element element, Environment environment) {
+ var result = '';
+ while (environment != null) {
+ result = '$result<ul>';
+ for (var symbol in environment.keys) {
+ result = '$result<li><b>$symbol</b>: ${environment[symbol]}</li>';
+ }
+ result = '$result</ul>';
+ result = '$result<hr/>';
+ environment = environment.owner;
+ }
+ element.innerHtml = result;
+}
+
+void main() {
+ var root = new Environment();
+ var native = Natives.import(root);
+ var standard = Standard.import(native.create());
+ var environment = standard.create();
+
+ var input = querySelector('#input') as TextAreaElement;
+ var output = querySelector('#output') as TextAreaElement;
+
+ querySelector('#evaluate').onClick.listen((event) {
+ var result = evalString(lispParser, environment, input.value);
+ output.value = result.toString();
+ inspector(querySelector('#inspector'), environment);
+ });
+ inspector(querySelector('#inspector'), environment);
+}
« no previous file with comments | « packages/petitparser/example/lispweb/lispweb.css ('k') | packages/petitparser/example/lispweb/lispweb.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698