about summary refs log tree commit diff
path: root/users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-13T13·53+0200
committerflokli <flokli@flokli.de>2023-10-16T11·49+0000
commitb8ef3e52637fc783ec03b209ce2f4f4a25152a27 (patch)
tree1bf5e37565ba6e54bc7b69a838e374b21cb3b34c /users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp
parentc739df3d78a81ea7943051a95702801eb3d219e9 (diff)
feat(users/flokli): add NixCon 2023 presentation r/6829
This adds the materials for the talk held at NixCon 2023, Darmstadt.

It seems it's not really possible to export a PDF out of this,
at least I couldn't get reveal-md to do it properly.

The video recordings live on
https://media.ccc.de/v/nixcon-2023-35254-tvix and
https://www.youtube.com/watch?v=j67prAPYScY .

Change-Id: Id27dc8c8637ffd455981141383c54d8d1484679e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9750
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp')
-rw-r--r--users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp b/users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp
new file mode 100644
index 000000000000..7c52bce8b6d2
--- /dev/null
+++ b/users/flokli/presentations/2023-09-09-nixcon-tvix/cppnix-example-lexer.cpp
@@ -0,0 +1,13 @@
+attrpath
+  : attrpath '.' attr {
+    $$ = $1; $1->push_back(AttrName(data->symbols.create($3)));
+  }
+  | attrpath '.' string_attr
+    { $$ = $1;
+      ExprString * str = dynamic_cast<ExprString *>($3);
+      if (str) {
+          $$->push_back(AttrName(data->symbols.create(str->s)));
+          delete str;
+      } else
+          $$->push_back(AttrName($3));
+    }