Commit d5eba005 authored by Kenton Varda's avatar Kenton Varda

Refactor lexer.capnp to use unnamed unions.

parent 7b8bbc87
...@@ -72,54 +72,54 @@ kj::String doLex(kj::StringPtr constText) { ...@@ -72,54 +72,54 @@ kj::String doLex(kj::StringPtr constText) {
TEST(Lexer, Tokens) { TEST(Lexer, Tokens) {
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = identifier('foo'), endByte = 3), " "(identifier = 'foo', endByte = 3), "
"(body = identifier('bar'), startByte = 4, endByte = 7)" "(identifier = 'bar', startByte = 4, endByte = 7)"
"])", "])",
doLex<LexedTokens>("foo bar").cStr()); doLex<LexedTokens>("foo bar").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = identifier('foo'), endByte = 3), " "(identifier = 'foo', endByte = 3), "
"(body = identifier('bar'), startByte = 15, endByte = 18)" "(identifier = 'bar', startByte = 15, endByte = 18)"
"])", "])",
doLex<LexedTokens>("foo # comment\n bar").cStr()); doLex<LexedTokens>("foo # comment\n bar").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = stringLiteral('foo '), startByte = 2, endByte = 11), " "(stringLiteral = 'foo ', startByte = 2, endByte = 11), "
"(body = integerLiteral(123), startByte = 12, endByte = 15), " "(integerLiteral = 123, startByte = 12, endByte = 15), "
"(body = floatLiteral(2.75), startByte = 16, endByte = 20), " "(floatLiteral = 2.75, startByte = 16, endByte = 20), "
"(body = floatLiteral(60000), startByte = 21, endByte = 24), " "(floatLiteral = 60000, startByte = 21, endByte = 24), "
"(body = operator('+'), startByte = 25, endByte = 26), " "(operator = '+', startByte = 25, endByte = 26), "
"(body = operator('-='), startByte = 27, endByte = 29)" "(operator = '-=', startByte = 27, endByte = 29)"
"])", "])",
doLex<LexedTokens>(" 'foo\\x20' 123 2.75 6e4 + -= ").cStr()); doLex<LexedTokens>(" 'foo\\x20' 123 2.75 6e4 + -= ").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = parenthesizedList([" "(parenthesizedList = ["
"[" "["
"(body = identifier('foo'), startByte = 1, endByte = 4), " "(identifier = 'foo', startByte = 1, endByte = 4), "
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"], [" "], ["
"(body = identifier('baz'), startByte = 10, endByte = 13), " "(identifier = 'baz', startByte = 10, endByte = 13), "
"(body = identifier('qux'), startByte = 14, endByte = 17)" "(identifier = 'qux', startByte = 14, endByte = 17)"
"], [" "], ["
"(body = identifier('corge'), startByte = 19, endByte = 24), " "(identifier = 'corge', startByte = 19, endByte = 24), "
"(body = identifier('grault'), startByte = 25, endByte = 31)" "(identifier = 'grault', startByte = 25, endByte = 31)"
"]" "]"
"]), endByte = 32)" "], endByte = 32)"
"])", "])",
doLex<LexedTokens>("(foo bar, baz qux, corge grault)").cStr()); doLex<LexedTokens>("(foo bar, baz qux, corge grault)").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = parenthesizedList([" "(parenthesizedList = ["
"[" "["
"(body = identifier('foo'), startByte = 1, endByte = 4), " "(identifier = 'foo', startByte = 1, endByte = 4), "
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"]" "]"
"]), endByte = 9)" "], endByte = 9)"
"])", "])",
doLex<LexedTokens>("(foo bar)").cStr()); doLex<LexedTokens>("(foo bar)").cStr());
...@@ -127,50 +127,50 @@ TEST(Lexer, Tokens) { ...@@ -127,50 +127,50 @@ TEST(Lexer, Tokens) {
// list. // list.
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = parenthesizedList([]), endByte = 4)" "(parenthesizedList = [], endByte = 4)"
"])", "])",
doLex<LexedTokens>("( )").cStr()); doLex<LexedTokens>("( )").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = bracketedList([" "(bracketedList = ["
"[" "["
"(body = identifier('foo'), startByte = 1, endByte = 4), " "(identifier = 'foo', startByte = 1, endByte = 4), "
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"], [" "], ["
"(body = identifier('baz'), startByte = 10, endByte = 13), " "(identifier = 'baz', startByte = 10, endByte = 13), "
"(body = identifier('qux'), startByte = 14, endByte = 17)" "(identifier = 'qux', startByte = 14, endByte = 17)"
"], [" "], ["
"(body = identifier('corge'), startByte = 19, endByte = 24), " "(identifier = 'corge', startByte = 19, endByte = 24), "
"(body = identifier('grault'), startByte = 25, endByte = 31)" "(identifier = 'grault', startByte = 25, endByte = 31)"
"]" "]"
"]), endByte = 32)" "], endByte = 32)"
"])", "])",
doLex<LexedTokens>("[foo bar, baz qux, corge grault]").cStr()); doLex<LexedTokens>("[foo bar, baz qux, corge grault]").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = bracketedList([" "(bracketedList = ["
"[" "["
"(body = identifier('foo'), startByte = 1, endByte = 4)" "(identifier = 'foo', startByte = 1, endByte = 4)"
"], [" "], ["
"(body = parenthesizedList([" "(parenthesizedList = ["
"[" "["
"(body = identifier('bar'), startByte = 7, endByte = 10)" "(identifier = 'bar', startByte = 7, endByte = 10)"
"], [" "], ["
"(body = identifier('baz'), startByte = 12, endByte = 15)" "(identifier = 'baz', startByte = 12, endByte = 15)"
"]" "]"
"]), startByte = 6, endByte = 16)" "], startByte = 6, endByte = 16)"
"]" "]"
"]), endByte = 17), " "], endByte = 17), "
"(body = identifier('qux'), startByte = 18, endByte = 21)" "(identifier = 'qux', startByte = 18, endByte = 21)"
"])", "])",
doLex<LexedTokens>("[foo, (bar, baz)] qux").cStr()); doLex<LexedTokens>("[foo, (bar, baz)] qux").cStr());
EXPECT_STREQ( EXPECT_STREQ(
"(tokens = [" "(tokens = ["
"(body = identifier('foo'), endByte = 3), " "(identifier = 'foo', endByte = 3), "
"(body = identifier('bar'), startByte = 7, endByte = 10)" "(identifier = 'bar', startByte = 7, endByte = 10)"
"])", "])",
doLex<LexedTokens>("foo\n\r\t\vbar").cStr()); doLex<LexedTokens>("foo\n\r\t\vbar").cStr());
} }
...@@ -179,8 +179,8 @@ TEST(Lexer, Statements) { ...@@ -179,8 +179,8 @@ TEST(Lexer, Statements) {
EXPECT_STREQ( EXPECT_STREQ(
"(statements = [" "(statements = ["
"(tokens = [" "(tokens = ["
"(body = identifier('foo'), endByte = 3), " "(identifier = 'foo', endByte = 3), "
"(body = identifier('bar'), startByte = 4, endByte = 7)" "(identifier = 'bar', startByte = 4, endByte = 7)"
"], endByte = 8)" "], endByte = 8)"
"])", "])",
doLex<LexedStatements>("foo bar;").cStr()); doLex<LexedStatements>("foo bar;").cStr());
...@@ -188,13 +188,13 @@ TEST(Lexer, Statements) { ...@@ -188,13 +188,13 @@ TEST(Lexer, Statements) {
EXPECT_STREQ( EXPECT_STREQ(
"(statements = [" "(statements = ["
"(tokens = [" "(tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], endByte = 4), " "], endByte = 4), "
"(tokens = [" "(tokens = ["
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"], startByte = 5, endByte = 9), " "], startByte = 5, endByte = 9), "
"(tokens = [" "(tokens = ["
"(body = identifier('baz'), startByte = 10, endByte = 13)" "(identifier = 'baz', startByte = 10, endByte = 13)"
"], startByte = 10, endByte = 14)" "], startByte = 10, endByte = 14)"
"])", "])",
doLex<LexedStatements>("foo; bar; baz; ").cStr()); doLex<LexedStatements>("foo; bar; baz; ").cStr());
...@@ -203,20 +203,20 @@ TEST(Lexer, Statements) { ...@@ -203,20 +203,20 @@ TEST(Lexer, Statements) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"block = statements([" "block = (statements = ["
"(tokens = [" "(tokens = ["
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"], startByte = 5, endByte = 9), " "], startByte = 5, endByte = 9), "
"(tokens = [" "(tokens = ["
"(body = identifier('baz'), startByte = 10, endByte = 13)" "(identifier = 'baz', startByte = 10, endByte = 13)"
"], startByte = 10, endByte = 14)" "], startByte = 10, endByte = 14)"
"]), " "]), "
"endByte = 15" "endByte = 15"
"), " "), "
"(tokens = [" "(tokens = ["
"(body = identifier('qux'), startByte = 16, endByte = 19)" "(identifier = 'qux', startByte = 16, endByte = 19)"
"], startByte = 16, endByte = 20)" "], startByte = 16, endByte = 20)"
"])", "])",
doLex<LexedStatements>("foo {bar; baz;} qux;").cStr()); doLex<LexedStatements>("foo {bar; baz;} qux;").cStr());
...@@ -227,7 +227,7 @@ TEST(Lexer, DocComments) { ...@@ -227,7 +227,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"docComment = 'blah blah\\n', " "docComment = 'blah blah\\n', "
"endByte = 16" "endByte = 16"
...@@ -239,7 +239,7 @@ TEST(Lexer, DocComments) { ...@@ -239,7 +239,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"docComment = 'blah blah\\n', " "docComment = 'blah blah\\n', "
"endByte = 15" "endByte = 15"
...@@ -251,7 +251,7 @@ TEST(Lexer, DocComments) { ...@@ -251,7 +251,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"docComment = ' blah blah\\n', " "docComment = ' blah blah\\n', "
"endByte = 17" "endByte = 17"
...@@ -263,7 +263,7 @@ TEST(Lexer, DocComments) { ...@@ -263,7 +263,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"docComment = 'blah blah\\n', " "docComment = 'blah blah\\n', "
"endByte = 16" "endByte = 16"
...@@ -275,7 +275,7 @@ TEST(Lexer, DocComments) { ...@@ -275,7 +275,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"endByte = 4" "endByte = 4"
")" ")"
...@@ -286,7 +286,7 @@ TEST(Lexer, DocComments) { ...@@ -286,7 +286,7 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"docComment = 'bar baz\\nqux corge\\n', " "docComment = 'bar baz\\nqux corge\\n', "
"endByte = 30" "endByte = 30"
...@@ -298,21 +298,21 @@ TEST(Lexer, DocComments) { ...@@ -298,21 +298,21 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"block = statements([" "block = (statements = ["
"(tokens = [" "(tokens = ["
"(body = identifier('bar'), startByte = 17, endByte = 20)" "(identifier = 'bar', startByte = 17, endByte = 20)"
"], docComment = 'hi\\n', startByte = 17, endByte = 27), " "], docComment = 'hi\\n', startByte = 17, endByte = 27), "
"(tokens = [" "(tokens = ["
"(body = identifier('baz'), startByte = 28, endByte = 31)" "(identifier = 'baz', startByte = 28, endByte = 31)"
"], startByte = 28, endByte = 32)" "], startByte = 28, endByte = 32)"
"]), " "]), "
"docComment = 'blah blah\\n', " "docComment = 'blah blah\\n', "
"endByte = 44" "endByte = 44"
"), " "), "
"(tokens = [" "(tokens = ["
"(body = identifier('qux'), startByte = 44, endByte = 47)" "(identifier = 'qux', startByte = 44, endByte = 47)"
"], startByte = 44, endByte = 48)" "], startByte = 44, endByte = 48)"
"])", "])",
doLex<LexedStatements>("foo {# blah blah\nbar; # hi\n baz;} # ignored\nqux;").cStr()); doLex<LexedStatements>("foo {# blah blah\nbar; # hi\n baz;} # ignored\nqux;").cStr());
...@@ -321,21 +321,21 @@ TEST(Lexer, DocComments) { ...@@ -321,21 +321,21 @@ TEST(Lexer, DocComments) {
"(statements = [" "(statements = ["
"(" "("
"tokens = [" "tokens = ["
"(body = identifier('foo'), endByte = 3)" "(identifier = 'foo', endByte = 3)"
"], " "], "
"block = statements([" "block = (statements = ["
"(tokens = [" "(tokens = ["
"(body = identifier('bar'), startByte = 5, endByte = 8)" "(identifier = 'bar', startByte = 5, endByte = 8)"
"], startByte = 5, endByte = 9), " "], startByte = 5, endByte = 9), "
"(tokens = [" "(tokens = ["
"(body = identifier('baz'), startByte = 10, endByte = 13)" "(identifier = 'baz', startByte = 10, endByte = 13)"
"], startByte = 10, endByte = 14)" "], startByte = 10, endByte = 14)"
"]), " "]), "
"docComment = 'late comment\\n', " "docComment = 'late comment\\n', "
"endByte = 31" "endByte = 31"
"), " "), "
"(tokens = [" "(tokens = ["
"(body = identifier('qux'), startByte = 31, endByte = 34)" "(identifier = 'qux', startByte = 31, endByte = 34)"
"], startByte = 31, endByte = 35)" "], startByte = 31, endByte = 35)"
"])", "])",
doLex<LexedStatements>("foo {bar; baz;}\n# late comment\nqux;").cStr()); doLex<LexedStatements>("foo {bar; baz;}\n# late comment\nqux;").cStr());
......
...@@ -78,11 +78,11 @@ namespace { ...@@ -78,11 +78,11 @@ namespace {
typedef p::Span<uint32_t> Location; typedef p::Span<uint32_t> Location;
Token::Body::Builder initTok(Orphan<Token>& t, const Location& loc) { Token::Builder initTok(Orphan<Token>& t, const Location& loc) {
auto tb = t.get(); auto builder = t.get();
tb.setStartByte(loc.begin()); builder.setStartByte(loc.begin());
tb.setEndByte(loc.end()); builder.setEndByte(loc.end());
return tb.getBody(); return builder;
} }
void buildTokenSequenceList(List<List<Token>>::Builder builder, void buildTokenSequenceList(List<List<Token>>::Builder builder,
......
...@@ -28,18 +28,18 @@ using Cxx = import "/capnp/c++.capnp"; ...@@ -28,18 +28,18 @@ using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("capnp::compiler"); $Cxx.namespace("capnp::compiler");
struct Token { struct Token {
body @0 union { union {
identifier @1 :Text; identifier @0 :Text;
stringLiteral @2 :Text; stringLiteral @1 :Text;
integerLiteral @3 :UInt64; integerLiteral @2 :UInt64;
floatLiteral @4 :Float64; floatLiteral @3 :Float64;
operator @5 :Text; operator @4 :Text;
parenthesizedList @6 :List(List(Token)); parenthesizedList @5 :List(List(Token));
bracketedList @7 :List(List(Token)); bracketedList @6 :List(List(Token));
} }
startByte @8 :UInt32; startByte @7 :UInt32;
endByte @9 :UInt32; endByte @8 :UInt32;
} }
struct Statement { struct Statement {
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
namespace capnp { namespace capnp {
namespace schemas { namespace schemas {
static const ::capnp::_::AlignedData<55> b_91cc55cd57de5419 = { static const ::capnp::_::AlignedData<165> b_91cc55cd57de5419 = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
25, 84, 222, 87, 205, 85, 204, 145, 25, 84, 222, 87, 205, 85, 204, 145,
0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 1, 0, 3, 0,
238, 195, 31, 98, 210, 86, 57, 167, 238, 195, 31, 98, 210, 86, 57, 167,
1, 0, 7, 0, 0, 0, 0, 0, 1, 0, 7, 0, 0, 0, 7, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 10, 1, 0, 0, 17, 0, 0, 0, 10, 1, 0, 0,
33, 0, 0, 0, 7, 0, 0, 0, 33, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
29, 0, 0, 0, 175, 0, 0, 0, 29, 0, 0, 0, 255, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 99, 111, 99, 97, 112, 110, 112, 47, 99, 111,
109, 112, 105, 108, 101, 114, 47, 108, 109, 112, 105, 108, 101, 114, 47, 108,
...@@ -23,121 +23,70 @@ static const ::capnp::_::AlignedData<55> b_91cc55cd57de5419 = { ...@@ -23,121 +23,70 @@ static const ::capnp::_::AlignedData<55> b_91cc55cd57de5419 = {
110, 112, 58, 84, 111, 107, 101, 110, 110, 112, 58, 84, 111, 107, 101, 110,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0,
12, 0, 0, 0, 3, 0, 4, 0, 36, 0, 0, 0, 3, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
51, 143, 77, 217, 86, 219, 152, 251,
69, 0, 0, 0, 42, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 8, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
45, 0, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
44, 0, 0, 0, 2, 0, 1, 0,
52, 0, 0, 0, 2, 0, 1, 0,
2, 0, 0, 0, 4, 0, 0, 0,
0, 0, 1, 0, 9, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
49, 0, 0, 0, 66, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
44, 0, 0, 0, 2, 0, 1, 0,
52, 0, 0, 0, 2, 0, 1, 0,
98, 111, 100, 121, 0, 0, 0, 0,
115, 116, 97, 114, 116, 66, 121, 116,
101, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
101, 110, 100, 66, 121, 116, 101, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, }
};
static const ::capnp::_::RawSchema* const d_91cc55cd57de5419[] = {
&s_fb98db56d94d8f33,
};
static const uint16_t m_91cc55cd57de5419[] = {0, 2, 1};
static const uint16_t i_91cc55cd57de5419[] = {0, 1, 2};
const ::capnp::_::RawSchema s_91cc55cd57de5419 = {
0x91cc55cd57de5419, b_91cc55cd57de5419.words, 55, d_91cc55cd57de5419, m_91cc55cd57de5419,
1, 3, i_91cc55cd57de5419, nullptr, nullptr
};
static const ::capnp::_::AlignedData<135> b_fb98db56d94d8f33 = {
{ 0, 0, 0, 0, 5, 0, 5, 0,
51, 143, 77, 217, 86, 219, 152, 251,
33, 0, 0, 0, 1, 0, 3, 0,
25, 84, 222, 87, 205, 85, 204, 145,
1, 0, 7, 0, 1, 0, 7, 0,
0, 0, 0, 0, 0, 0, 0, 0,
17, 0, 0, 0, 50, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
25, 0, 0, 0, 143, 1, 0, 0, 237, 0, 0, 0, 90, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99, 97, 112, 110, 112, 47, 99, 111, 236, 0, 0, 0, 2, 0, 1, 0,
109, 112, 105, 108, 101, 114, 47, 108, 244, 0, 0, 0, 2, 0, 1, 0,
101, 120, 101, 114, 46, 99, 97, 112, 1, 0, 254, 255, 0, 0, 0, 0,
110, 112, 58, 84, 111, 107, 101, 110,
46, 98, 111, 100, 121, 0, 0, 0,
28, 0, 0, 0, 3, 0, 4, 0,
0, 0, 255, 255, 0, 0, 0, 0,
0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
181, 0, 0, 0, 90, 0, 0, 0, 241, 0, 0, 0, 114, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
180, 0, 0, 0, 2, 0, 1, 0, 240, 0, 0, 0, 2, 0, 1, 0,
188, 0, 0, 0, 2, 0, 1, 0, 248, 0, 0, 0, 2, 0, 1, 0,
1, 0, 254, 255, 0, 0, 0, 0, 2, 0, 253, 255, 1, 0, 0, 0,
0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
185, 0, 0, 0, 114, 0, 0, 0, 245, 0, 0, 0, 122, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
184, 0, 0, 0, 2, 0, 1, 0, 244, 0, 0, 0, 2, 0, 1, 0,
192, 0, 0, 0, 2, 0, 1, 0, 252, 0, 0, 0, 2, 0, 1, 0,
2, 0, 253, 255, 1, 0, 0, 0, 3, 0, 252, 255, 1, 0, 0, 0,
0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
189, 0, 0, 0, 122, 0, 0, 0, 249, 0, 0, 0, 106, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
188, 0, 0, 0, 2, 0, 1, 0, 248, 0, 0, 0, 2, 0, 1, 0,
196, 0, 0, 0, 2, 0, 1, 0, 0, 1, 0, 0, 2, 0, 1, 0,
3, 0, 252, 255, 1, 0, 0, 0, 4, 0, 251, 255, 0, 0, 0, 0,
0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
193, 0, 0, 0, 106, 0, 0, 0, 253, 0, 0, 0, 74, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
192, 0, 0, 0, 2, 0, 1, 0, 252, 0, 0, 0, 2, 0, 1, 0,
200, 0, 0, 0, 2, 0, 1, 0, 4, 1, 0, 0, 2, 0, 1, 0,
4, 0, 251, 255, 0, 0, 0, 0, 5, 0, 250, 255, 0, 0, 0, 0,
0, 0, 1, 0, 5, 0, 0, 0, 0, 0, 1, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
197, 0, 0, 0, 74, 0, 0, 0, 1, 1, 0, 0, 146, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
196, 0, 0, 0, 2, 0, 1, 0, 4, 1, 0, 0, 2, 0, 1, 0,
204, 0, 0, 0, 2, 0, 1, 0, 36, 1, 0, 0, 2, 0, 1, 0,
5, 0, 250, 255, 0, 0, 0, 0, 6, 0, 249, 255, 0, 0, 0, 0,
0, 0, 1, 0, 6, 0, 0, 0, 0, 0, 1, 0, 6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
201, 0, 0, 0, 146, 0, 0, 0, 33, 1, 0, 0, 114, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
204, 0, 0, 0, 2, 0, 1, 0, 32, 1, 0, 0, 2, 0, 1, 0,
236, 0, 0, 0, 2, 0, 1, 0, 64, 1, 0, 0, 2, 0, 1, 0,
6, 0, 249, 255, 0, 0, 0, 0, 7, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 7, 0, 0, 0, 0, 0, 1, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
233, 0, 0, 0, 114, 0, 0, 0, 61, 1, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
60, 1, 0, 0, 2, 0, 1, 0,
68, 1, 0, 0, 2, 0, 1, 0,
8, 0, 0, 0, 4, 0, 0, 0,
0, 0, 1, 0, 8, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
65, 1, 0, 0, 66, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
232, 0, 0, 0, 2, 0, 1, 0, 60, 1, 0, 0, 2, 0, 1, 0,
8, 1, 0, 0, 2, 0, 1, 0, 68, 1, 0, 0, 2, 0, 1, 0,
105, 100, 101, 110, 116, 105, 102, 105, 105, 100, 101, 110, 116, 105, 102, 105,
101, 114, 0, 0, 0, 0, 0, 0, 101, 114, 0, 0, 0, 0, 0, 0,
12, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
...@@ -205,17 +154,32 @@ static const ::capnp::_::AlignedData<135> b_fb98db56d94d8f33 = { ...@@ -205,17 +154,32 @@ static const ::capnp::_::AlignedData<135> b_fb98db56d94d8f33 = {
25, 84, 222, 87, 205, 85, 204, 145, 25, 84, 222, 87, 205, 85, 204, 145,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
115, 116, 97, 114, 116, 66, 121, 116,
101, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
101, 110, 100, 66, 121, 116, 101, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
8, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, } 0, 0, 0, 0, 0, 0, 0, 0, }
}; };
static const ::capnp::_::RawSchema* const d_fb98db56d94d8f33[] = { static const ::capnp::_::RawSchema* const d_91cc55cd57de5419[] = {
&s_91cc55cd57de5419, &s_91cc55cd57de5419,
}; };
static const uint16_t m_fb98db56d94d8f33[] = {6, 3, 0, 2, 4, 5, 1}; static const uint16_t m_91cc55cd57de5419[] = {6, 8, 3, 0, 2, 4, 5, 7, 1};
static const uint16_t i_fb98db56d94d8f33[] = {0, 1, 2, 3, 4, 5, 6}; static const uint16_t i_91cc55cd57de5419[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
const ::capnp::_::RawSchema s_fb98db56d94d8f33 = { const ::capnp::_::RawSchema s_91cc55cd57de5419 = {
0xfb98db56d94d8f33, b_fb98db56d94d8f33.words, 135, d_fb98db56d94d8f33, m_fb98db56d94d8f33, 0x91cc55cd57de5419, b_91cc55cd57de5419.words, 165, d_91cc55cd57de5419, m_91cc55cd57de5419,
1, 7, i_fb98db56d94d8f33, nullptr, nullptr 1, 9, i_91cc55cd57de5419, nullptr, nullptr
}; };
static const ::capnp::_::AlignedData<87> b_c6725e678d60fa37 = { static const ::capnp::_::AlignedData<87> b_c6725e678d60fa37 = {
{ 0, 0, 0, 0, 5, 0, 5, 0, { 0, 0, 0, 0, 5, 0, 5, 0,
...@@ -475,8 +439,6 @@ const ::capnp::_::RawSchema s_a11f97b9d6c73dd4 = { ...@@ -475,8 +439,6 @@ const ::capnp::_::RawSchema s_a11f97b9d6c73dd4 = {
namespace _ { // private namespace _ { // private
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::compiler::Token); ::capnp::compiler::Token);
CAPNP_DEFINE_STRUCT(
::capnp::compiler::Token::Body);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
::capnp::compiler::Statement); ::capnp::compiler::Statement);
CAPNP_DEFINE_STRUCT( CAPNP_DEFINE_STRUCT(
......
...@@ -12,14 +12,6 @@ namespace compiler { ...@@ -12,14 +12,6 @@ namespace compiler {
struct Token { struct Token {
Token() = delete; Token() = delete;
class Reader;
class Builder;
struct Body;
};
struct Token::Body {
Body() = delete;
class Reader; class Reader;
class Builder; class Builder;
enum Which: uint16_t { enum Which: uint16_t {
...@@ -75,7 +67,6 @@ namespace capnp { ...@@ -75,7 +67,6 @@ namespace capnp {
namespace schemas { namespace schemas {
extern const ::capnp::_::RawSchema s_91cc55cd57de5419; extern const ::capnp::_::RawSchema s_91cc55cd57de5419;
extern const ::capnp::_::RawSchema s_fb98db56d94d8f33;
extern const ::capnp::_::RawSchema s_c6725e678d60fa37; extern const ::capnp::_::RawSchema s_c6725e678d60fa37;
extern const ::capnp::_::RawSchema s_dd02827efc95ca64; extern const ::capnp::_::RawSchema s_dd02827efc95ca64;
extern const ::capnp::_::RawSchema s_9e69a92512b19d18; extern const ::capnp::_::RawSchema s_9e69a92512b19d18;
...@@ -87,9 +78,6 @@ namespace _ { // private ...@@ -87,9 +78,6 @@ namespace _ { // private
CAPNP_DECLARE_STRUCT( CAPNP_DECLARE_STRUCT(
::capnp::compiler::Token, 91cc55cd57de5419, ::capnp::compiler::Token, 91cc55cd57de5419,
3, 1, INLINE_COMPOSITE); 3, 1, INLINE_COMPOSITE);
CAPNP_DECLARE_STRUCT(
::capnp::compiler::Token::Body, fb98db56d94d8f33,
3, 1, INLINE_COMPOSITE);
CAPNP_DECLARE_STRUCT( CAPNP_DECLARE_STRUCT(
::capnp::compiler::Statement, c6725e678d60fa37, ::capnp::compiler::Statement, c6725e678d60fa37,
2, 3, INLINE_COMPOSITE); 2, 3, INLINE_COMPOSITE);
...@@ -122,76 +110,6 @@ public: ...@@ -122,76 +110,6 @@ public:
return _reader.totalSize() / ::capnp::WORDS; return _reader.totalSize() / ::capnp::WORDS;
} }
inline Body::Reader getBody() const;
inline bool hasStartByte() const;
inline ::uint32_t getStartByte() const;
inline bool hasEndByte() const;
inline ::uint32_t getEndByte() const;
private:
::capnp::_::StructReader _reader;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::_::PointerHelpers;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::List;
friend class ::capnp::MessageBuilder;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Token::Reader reader);
};
inline ::kj::StringTree KJ_STRINGIFY(Token::Reader reader) {
return ::capnp::_::structString<Token>(reader._reader);
}
class Token::Builder {
public:
typedef Token Builds;
Builder() = default;
inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
inline operator Reader() const { return Reader(_builder.asReader()); }
inline Reader asReader() const { return *this; }
inline size_t totalSizeInWords() { return asReader().totalSizeInWords(); }
inline Body::Builder getBody();
inline Body::Builder initBody();
inline bool hasStartByte();
inline ::uint32_t getStartByte();
inline void setStartByte( ::uint32_t value);
inline bool hasEndByte();
inline ::uint32_t getEndByte();
inline void setEndByte( ::uint32_t value);
private:
::capnp::_::StructBuilder _builder;
template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_;
friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Token::Builder builder);
};
inline ::kj::StringTree KJ_STRINGIFY(Token::Builder builder) {
return ::capnp::_::structString<Token>(builder._builder.asReader());
}
class Token::Body::Reader {
public:
typedef Body Reads;
Reader() = default;
inline explicit Reader(::capnp::_::StructReader base): _reader(base) {}
inline size_t totalSizeInWords() const {
return _reader.totalSize() / ::capnp::WORDS;
}
inline Which which() const; inline Which which() const;
inline bool hasIdentifier() const; inline bool hasIdentifier() const;
inline ::capnp::Text::Reader getIdentifier() const; inline ::capnp::Text::Reader getIdentifier() const;
...@@ -214,6 +132,12 @@ public: ...@@ -214,6 +132,12 @@ public:
inline bool hasBracketedList() const; inline bool hasBracketedList() const;
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader getBracketedList() const; inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader getBracketedList() const;
inline bool hasStartByte() const;
inline ::uint32_t getStartByte() const;
inline bool hasEndByte() const;
inline ::uint32_t getEndByte() const;
private: private:
::capnp::_::StructReader _reader; ::capnp::_::StructReader _reader;
template <typename T, ::capnp::Kind k> template <typename T, ::capnp::Kind k>
...@@ -224,16 +148,16 @@ private: ...@@ -224,16 +148,16 @@ private:
friend struct ::capnp::List; friend struct ::capnp::List;
friend class ::capnp::MessageBuilder; friend class ::capnp::MessageBuilder;
friend class ::capnp::Orphanage; friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Token::Body::Reader reader); friend ::kj::StringTree KJ_STRINGIFY(Token::Reader reader);
}; };
inline ::kj::StringTree KJ_STRINGIFY(Token::Body::Reader reader) { inline ::kj::StringTree KJ_STRINGIFY(Token::Reader reader) {
return ::capnp::_::structString<Token::Body>(reader._reader); return ::capnp::_::structString<Token>(reader._reader);
} }
class Token::Body::Builder { class Token::Builder {
public: public:
typedef Body Builds; typedef Token Builds;
Builder() = default; Builder() = default;
inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {} inline explicit Builder(::capnp::_::StructBuilder base): _builder(base) {}
...@@ -288,16 +212,24 @@ public: ...@@ -288,16 +212,24 @@ public:
inline void adoptBracketedList(::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value); inline void adoptBracketedList(::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value);
inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> disownBracketedList(); inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> disownBracketedList();
inline bool hasStartByte();
inline ::uint32_t getStartByte();
inline void setStartByte( ::uint32_t value);
inline bool hasEndByte();
inline ::uint32_t getEndByte();
inline void setEndByte( ::uint32_t value);
private: private:
::capnp::_::StructBuilder _builder; ::capnp::_::StructBuilder _builder;
template <typename T, ::capnp::Kind k> template <typename T, ::capnp::Kind k>
friend struct ::capnp::ToDynamic_; friend struct ::capnp::ToDynamic_;
friend class ::capnp::Orphanage; friend class ::capnp::Orphanage;
friend ::kj::StringTree KJ_STRINGIFY(Token::Body::Builder builder); friend ::kj::StringTree KJ_STRINGIFY(Token::Builder builder);
}; };
inline ::kj::StringTree KJ_STRINGIFY(Token::Body::Builder builder) { inline ::kj::StringTree KJ_STRINGIFY(Token::Builder builder) {
return ::capnp::_::structString<Token::Body>(builder._builder.asReader()); return ::capnp::_::structString<Token>(builder._builder.asReader());
} }
class Statement::Reader { class Statement::Reader {
...@@ -584,378 +516,369 @@ inline ::kj::StringTree KJ_STRINGIFY(LexedStatements::Builder builder) { ...@@ -584,378 +516,369 @@ inline ::kj::StringTree KJ_STRINGIFY(LexedStatements::Builder builder) {
// ======================================================================================= // =======================================================================================
inline Token::Body::Reader Token::Reader::getBody() const { inline Token::Which Token::Reader::which() const {
return Token::Body::Reader(_reader);
}
inline Token::Body::Builder Token::Builder::getBody() {
return Token::Body::Builder(_builder);
}
inline Token::Body::Builder Token::Builder::initBody() {
return Token::Body::Builder(_builder);
}
inline bool Token::Reader::hasStartByte() const {
return _reader.hasDataField< ::uint32_t>(1 * ::capnp::ELEMENTS);
}
inline bool Token::Builder::hasStartByte() {
return _builder.hasDataField< ::uint32_t>(1 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Reader::getStartByte() const {
return _reader.getDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Builder::getStartByte() {
return _builder.getDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS);
}
inline void Token::Builder::setStartByte( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS, value);
}
inline bool Token::Reader::hasEndByte() const {
return _reader.hasDataField< ::uint32_t>(4 * ::capnp::ELEMENTS);
}
inline bool Token::Builder::hasEndByte() {
return _builder.hasDataField< ::uint32_t>(4 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Reader::getEndByte() const {
return _reader.getDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Builder::getEndByte() {
return _builder.getDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS);
}
inline void Token::Builder::setEndByte( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS, value);
}
inline Token::Body::Which Token::Body::Reader::which() const {
return _reader.getDataField<Which>(0 * ::capnp::ELEMENTS); return _reader.getDataField<Which>(0 * ::capnp::ELEMENTS);
} }
inline Token::Body::Which Token::Body::Builder::which() { inline Token::Which Token::Builder::which() {
return _builder.getDataField<Which>(0 * ::capnp::ELEMENTS); return _builder.getDataField<Which>(0 * ::capnp::ELEMENTS);
} }
inline bool Token::Body::Reader::hasIdentifier() const { inline bool Token::Reader::hasIdentifier() const {
KJ_IREQUIRE(which() == Token::Body::IDENTIFIER, KJ_IREQUIRE(which() == Token::IDENTIFIER,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Builder::hasIdentifier() { inline bool Token::Builder::hasIdentifier() {
KJ_IREQUIRE(which() == Token::Body::IDENTIFIER, KJ_IREQUIRE(which() == Token::IDENTIFIER,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS); return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Reader Token::Body::Reader::getIdentifier() const { inline ::capnp::Text::Reader Token::Reader::getIdentifier() const {
KJ_IREQUIRE(which() == Token::Body::IDENTIFIER, KJ_IREQUIRE(which() == Token::IDENTIFIER,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_reader, 0 * ::capnp::POINTERS); _reader, 0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Builder Token::Body::Builder::getIdentifier() { inline ::capnp::Text::Builder Token::Builder::getIdentifier() {
KJ_IREQUIRE(which() == Token::Body::IDENTIFIER, KJ_IREQUIRE(which() == Token::IDENTIFIER,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline void Token::Body::Builder::setIdentifier( ::capnp::Text::Reader value) { inline void Token::Builder::setIdentifier( ::capnp::Text::Reader value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::IDENTIFIER); 0 * ::capnp::ELEMENTS, Token::IDENTIFIER);
::capnp::_::PointerHelpers< ::capnp::Text>::set( ::capnp::_::PointerHelpers< ::capnp::Text>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline ::capnp::Text::Builder Token::Body::Builder::initIdentifier(unsigned int size) { inline ::capnp::Text::Builder Token::Builder::initIdentifier(unsigned int size) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::IDENTIFIER); 0 * ::capnp::ELEMENTS, Token::IDENTIFIER);
return ::capnp::_::PointerHelpers< ::capnp::Text>::init( return ::capnp::_::PointerHelpers< ::capnp::Text>::init(
_builder, 0 * ::capnp::POINTERS, size); _builder, 0 * ::capnp::POINTERS, size);
} }
inline void Token::Body::Builder::adoptIdentifier( inline void Token::Builder::adoptIdentifier(
::capnp::Orphan< ::capnp::Text>&& value) { ::capnp::Orphan< ::capnp::Text>&& value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::IDENTIFIER); 0 * ::capnp::ELEMENTS, Token::IDENTIFIER);
::capnp::_::PointerHelpers< ::capnp::Text>::adopt( ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(
_builder, 0 * ::capnp::POINTERS, kj::mv(value)); _builder, 0 * ::capnp::POINTERS, kj::mv(value));
} }
inline ::capnp::Orphan< ::capnp::Text> Token::Body::Builder::disownIdentifier() { inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownIdentifier() {
KJ_IREQUIRE(which() == Token::Body::IDENTIFIER, KJ_IREQUIRE(which() == Token::IDENTIFIER,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::disown( return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Reader::hasStringLiteral() const { inline bool Token::Reader::hasStringLiteral() const {
KJ_IREQUIRE(which() == Token::Body::STRING_LITERAL, KJ_IREQUIRE(which() == Token::STRING_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Builder::hasStringLiteral() { inline bool Token::Builder::hasStringLiteral() {
KJ_IREQUIRE(which() == Token::Body::STRING_LITERAL, KJ_IREQUIRE(which() == Token::STRING_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS); return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Reader Token::Body::Reader::getStringLiteral() const { inline ::capnp::Text::Reader Token::Reader::getStringLiteral() const {
KJ_IREQUIRE(which() == Token::Body::STRING_LITERAL, KJ_IREQUIRE(which() == Token::STRING_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_reader, 0 * ::capnp::POINTERS); _reader, 0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Builder Token::Body::Builder::getStringLiteral() { inline ::capnp::Text::Builder Token::Builder::getStringLiteral() {
KJ_IREQUIRE(which() == Token::Body::STRING_LITERAL, KJ_IREQUIRE(which() == Token::STRING_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline void Token::Body::Builder::setStringLiteral( ::capnp::Text::Reader value) { inline void Token::Builder::setStringLiteral( ::capnp::Text::Reader value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::STRING_LITERAL); 0 * ::capnp::ELEMENTS, Token::STRING_LITERAL);
::capnp::_::PointerHelpers< ::capnp::Text>::set( ::capnp::_::PointerHelpers< ::capnp::Text>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline ::capnp::Text::Builder Token::Body::Builder::initStringLiteral(unsigned int size) { inline ::capnp::Text::Builder Token::Builder::initStringLiteral(unsigned int size) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::STRING_LITERAL); 0 * ::capnp::ELEMENTS, Token::STRING_LITERAL);
return ::capnp::_::PointerHelpers< ::capnp::Text>::init( return ::capnp::_::PointerHelpers< ::capnp::Text>::init(
_builder, 0 * ::capnp::POINTERS, size); _builder, 0 * ::capnp::POINTERS, size);
} }
inline void Token::Body::Builder::adoptStringLiteral( inline void Token::Builder::adoptStringLiteral(
::capnp::Orphan< ::capnp::Text>&& value) { ::capnp::Orphan< ::capnp::Text>&& value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::STRING_LITERAL); 0 * ::capnp::ELEMENTS, Token::STRING_LITERAL);
::capnp::_::PointerHelpers< ::capnp::Text>::adopt( ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(
_builder, 0 * ::capnp::POINTERS, kj::mv(value)); _builder, 0 * ::capnp::POINTERS, kj::mv(value));
} }
inline ::capnp::Orphan< ::capnp::Text> Token::Body::Builder::disownStringLiteral() { inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownStringLiteral() {
KJ_IREQUIRE(which() == Token::Body::STRING_LITERAL, KJ_IREQUIRE(which() == Token::STRING_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::disown( return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Reader::hasIntegerLiteral() const { inline bool Token::Reader::hasIntegerLiteral() const {
KJ_IREQUIRE(which() == Token::Body::INTEGER_LITERAL, KJ_IREQUIRE(which() == Token::INTEGER_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _reader.hasDataField< ::uint64_t>(1 * ::capnp::ELEMENTS); return _reader.hasDataField< ::uint64_t>(1 * ::capnp::ELEMENTS);
} }
inline bool Token::Body::Builder::hasIntegerLiteral() { inline bool Token::Builder::hasIntegerLiteral() {
KJ_IREQUIRE(which() == Token::Body::INTEGER_LITERAL, KJ_IREQUIRE(which() == Token::INTEGER_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _builder.hasDataField< ::uint64_t>(1 * ::capnp::ELEMENTS); return _builder.hasDataField< ::uint64_t>(1 * ::capnp::ELEMENTS);
} }
inline ::uint64_t Token::Body::Reader::getIntegerLiteral() const { inline ::uint64_t Token::Reader::getIntegerLiteral() const {
KJ_IREQUIRE(which() == Token::Body::INTEGER_LITERAL, KJ_IREQUIRE(which() == Token::INTEGER_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _reader.getDataField< ::uint64_t>( return _reader.getDataField< ::uint64_t>(
1 * ::capnp::ELEMENTS); 1 * ::capnp::ELEMENTS);
} }
inline ::uint64_t Token::Body::Builder::getIntegerLiteral() { inline ::uint64_t Token::Builder::getIntegerLiteral() {
KJ_IREQUIRE(which() == Token::Body::INTEGER_LITERAL, KJ_IREQUIRE(which() == Token::INTEGER_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _builder.getDataField< ::uint64_t>( return _builder.getDataField< ::uint64_t>(
1 * ::capnp::ELEMENTS); 1 * ::capnp::ELEMENTS);
} }
inline void Token::Body::Builder::setIntegerLiteral( ::uint64_t value) { inline void Token::Builder::setIntegerLiteral( ::uint64_t value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::INTEGER_LITERAL); 0 * ::capnp::ELEMENTS, Token::INTEGER_LITERAL);
_builder.setDataField< ::uint64_t>( _builder.setDataField< ::uint64_t>(
1 * ::capnp::ELEMENTS, value); 1 * ::capnp::ELEMENTS, value);
} }
inline bool Token::Body::Reader::hasFloatLiteral() const { inline bool Token::Reader::hasFloatLiteral() const {
KJ_IREQUIRE(which() == Token::Body::FLOAT_LITERAL, KJ_IREQUIRE(which() == Token::FLOAT_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _reader.hasDataField<double>(1 * ::capnp::ELEMENTS); return _reader.hasDataField<double>(1 * ::capnp::ELEMENTS);
} }
inline bool Token::Body::Builder::hasFloatLiteral() { inline bool Token::Builder::hasFloatLiteral() {
KJ_IREQUIRE(which() == Token::Body::FLOAT_LITERAL, KJ_IREQUIRE(which() == Token::FLOAT_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _builder.hasDataField<double>(1 * ::capnp::ELEMENTS); return _builder.hasDataField<double>(1 * ::capnp::ELEMENTS);
} }
inline double Token::Body::Reader::getFloatLiteral() const { inline double Token::Reader::getFloatLiteral() const {
KJ_IREQUIRE(which() == Token::Body::FLOAT_LITERAL, KJ_IREQUIRE(which() == Token::FLOAT_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _reader.getDataField<double>( return _reader.getDataField<double>(
1 * ::capnp::ELEMENTS); 1 * ::capnp::ELEMENTS);
} }
inline double Token::Body::Builder::getFloatLiteral() { inline double Token::Builder::getFloatLiteral() {
KJ_IREQUIRE(which() == Token::Body::FLOAT_LITERAL, KJ_IREQUIRE(which() == Token::FLOAT_LITERAL,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return _builder.getDataField<double>( return _builder.getDataField<double>(
1 * ::capnp::ELEMENTS); 1 * ::capnp::ELEMENTS);
} }
inline void Token::Body::Builder::setFloatLiteral(double value) { inline void Token::Builder::setFloatLiteral(double value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::FLOAT_LITERAL); 0 * ::capnp::ELEMENTS, Token::FLOAT_LITERAL);
_builder.setDataField<double>( _builder.setDataField<double>(
1 * ::capnp::ELEMENTS, value); 1 * ::capnp::ELEMENTS, value);
} }
inline bool Token::Body::Reader::hasOperator() const { inline bool Token::Reader::hasOperator() const {
KJ_IREQUIRE(which() == Token::Body::OPERATOR, KJ_IREQUIRE(which() == Token::OPERATOR,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Builder::hasOperator() { inline bool Token::Builder::hasOperator() {
KJ_IREQUIRE(which() == Token::Body::OPERATOR, KJ_IREQUIRE(which() == Token::OPERATOR,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS); return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Reader Token::Body::Reader::getOperator() const { inline ::capnp::Text::Reader Token::Reader::getOperator() const {
KJ_IREQUIRE(which() == Token::Body::OPERATOR, KJ_IREQUIRE(which() == Token::OPERATOR,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_reader, 0 * ::capnp::POINTERS); _reader, 0 * ::capnp::POINTERS);
} }
inline ::capnp::Text::Builder Token::Body::Builder::getOperator() { inline ::capnp::Text::Builder Token::Builder::getOperator() {
KJ_IREQUIRE(which() == Token::Body::OPERATOR, KJ_IREQUIRE(which() == Token::OPERATOR,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::get( return ::capnp::_::PointerHelpers< ::capnp::Text>::get(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline void Token::Body::Builder::setOperator( ::capnp::Text::Reader value) { inline void Token::Builder::setOperator( ::capnp::Text::Reader value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::OPERATOR); 0 * ::capnp::ELEMENTS, Token::OPERATOR);
::capnp::_::PointerHelpers< ::capnp::Text>::set( ::capnp::_::PointerHelpers< ::capnp::Text>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline ::capnp::Text::Builder Token::Body::Builder::initOperator(unsigned int size) { inline ::capnp::Text::Builder Token::Builder::initOperator(unsigned int size) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::OPERATOR); 0 * ::capnp::ELEMENTS, Token::OPERATOR);
return ::capnp::_::PointerHelpers< ::capnp::Text>::init( return ::capnp::_::PointerHelpers< ::capnp::Text>::init(
_builder, 0 * ::capnp::POINTERS, size); _builder, 0 * ::capnp::POINTERS, size);
} }
inline void Token::Body::Builder::adoptOperator( inline void Token::Builder::adoptOperator(
::capnp::Orphan< ::capnp::Text>&& value) { ::capnp::Orphan< ::capnp::Text>&& value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::OPERATOR); 0 * ::capnp::ELEMENTS, Token::OPERATOR);
::capnp::_::PointerHelpers< ::capnp::Text>::adopt( ::capnp::_::PointerHelpers< ::capnp::Text>::adopt(
_builder, 0 * ::capnp::POINTERS, kj::mv(value)); _builder, 0 * ::capnp::POINTERS, kj::mv(value));
} }
inline ::capnp::Orphan< ::capnp::Text> Token::Body::Builder::disownOperator() { inline ::capnp::Orphan< ::capnp::Text> Token::Builder::disownOperator() {
KJ_IREQUIRE(which() == Token::Body::OPERATOR, KJ_IREQUIRE(which() == Token::OPERATOR,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::Text>::disown( return ::capnp::_::PointerHelpers< ::capnp::Text>::disown(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Reader::hasParenthesizedList() const { inline bool Token::Reader::hasParenthesizedList() const {
KJ_IREQUIRE(which() == Token::Body::PARENTHESIZED_LIST, KJ_IREQUIRE(which() == Token::PARENTHESIZED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Builder::hasParenthesizedList() { inline bool Token::Builder::hasParenthesizedList() {
KJ_IREQUIRE(which() == Token::Body::PARENTHESIZED_LIST, KJ_IREQUIRE(which() == Token::PARENTHESIZED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS); return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Body::Reader::getParenthesizedList() const { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Reader::getParenthesizedList() const {
KJ_IREQUIRE(which() == Token::Body::PARENTHESIZED_LIST, KJ_IREQUIRE(which() == Token::PARENTHESIZED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(
_reader, 0 * ::capnp::POINTERS); _reader, 0 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Body::Builder::getParenthesizedList() { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::getParenthesizedList() {
KJ_IREQUIRE(which() == Token::Body::PARENTHESIZED_LIST, KJ_IREQUIRE(which() == Token::PARENTHESIZED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline void Token::Body::Builder::setParenthesizedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) { inline void Token::Builder::setParenthesizedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::PARENTHESIZED_LIST); 0 * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline void Token::Body::Builder::setParenthesizedList(std::initializer_list< ::capnp::List< ::capnp::compiler::Token>::Reader> value) { inline void Token::Builder::setParenthesizedList(std::initializer_list< ::capnp::List< ::capnp::compiler::Token>::Reader> value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::PARENTHESIZED_LIST); 0 * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Body::Builder::initParenthesizedList(unsigned int size) { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::initParenthesizedList(unsigned int size) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::PARENTHESIZED_LIST); 0 * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST);
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init(
_builder, 0 * ::capnp::POINTERS, size); _builder, 0 * ::capnp::POINTERS, size);
} }
inline void Token::Body::Builder::adoptParenthesizedList( inline void Token::Builder::adoptParenthesizedList(
::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) { ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::PARENTHESIZED_LIST); 0 * ::capnp::ELEMENTS, Token::PARENTHESIZED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt(
_builder, 0 * ::capnp::POINTERS, kj::mv(value)); _builder, 0 * ::capnp::POINTERS, kj::mv(value));
} }
inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Body::Builder::disownParenthesizedList() { inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Builder::disownParenthesizedList() {
KJ_IREQUIRE(which() == Token::Body::PARENTHESIZED_LIST, KJ_IREQUIRE(which() == Token::PARENTHESIZED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Reader::hasBracketedList() const { inline bool Token::Reader::hasBracketedList() const {
KJ_IREQUIRE(which() == Token::Body::BRACKETED_LIST, KJ_IREQUIRE(which() == Token::BRACKETED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline bool Token::Body::Builder::hasBracketedList() { inline bool Token::Builder::hasBracketedList() {
KJ_IREQUIRE(which() == Token::Body::BRACKETED_LIST, KJ_IREQUIRE(which() == Token::BRACKETED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS); return !_builder.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Body::Reader::getBracketedList() const { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader Token::Reader::getBracketedList() const {
KJ_IREQUIRE(which() == Token::Body::BRACKETED_LIST, KJ_IREQUIRE(which() == Token::BRACKETED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(
_reader, 0 * ::capnp::POINTERS); _reader, 0 * ::capnp::POINTERS);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Body::Builder::getBracketedList() { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::getBracketedList() {
KJ_IREQUIRE(which() == Token::Body::BRACKETED_LIST, KJ_IREQUIRE(which() == Token::BRACKETED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::get(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline void Token::Body::Builder::setBracketedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) { inline void Token::Builder::setBracketedList( ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Reader value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::BRACKETED_LIST); 0 * ::capnp::ELEMENTS, Token::BRACKETED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline void Token::Body::Builder::setBracketedList(std::initializer_list< ::capnp::List< ::capnp::compiler::Token>::Reader> value) { inline void Token::Builder::setBracketedList(std::initializer_list< ::capnp::List< ::capnp::compiler::Token>::Reader> value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::BRACKETED_LIST); 0 * ::capnp::ELEMENTS, Token::BRACKETED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::set(
_builder, 0 * ::capnp::POINTERS, value); _builder, 0 * ::capnp::POINTERS, value);
} }
inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Body::Builder::initBracketedList(unsigned int size) { inline ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>::Builder Token::Builder::initBracketedList(unsigned int size) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::BRACKETED_LIST); 0 * ::capnp::ELEMENTS, Token::BRACKETED_LIST);
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::init(
_builder, 0 * ::capnp::POINTERS, size); _builder, 0 * ::capnp::POINTERS, size);
} }
inline void Token::Body::Builder::adoptBracketedList( inline void Token::Builder::adoptBracketedList(
::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) { ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>&& value) {
_builder.setDataField<Token::Body::Which>( _builder.setDataField<Token::Which>(
0 * ::capnp::ELEMENTS, Token::Body::BRACKETED_LIST); 0 * ::capnp::ELEMENTS, Token::BRACKETED_LIST);
::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt( ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::adopt(
_builder, 0 * ::capnp::POINTERS, kj::mv(value)); _builder, 0 * ::capnp::POINTERS, kj::mv(value));
} }
inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Body::Builder::disownBracketedList() { inline ::capnp::Orphan< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>> Token::Builder::disownBracketedList() {
KJ_IREQUIRE(which() == Token::Body::BRACKETED_LIST, KJ_IREQUIRE(which() == Token::BRACKETED_LIST,
"Must check which() before get()ing a union member."); "Must check which() before get()ing a union member.");
return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown( return ::capnp::_::PointerHelpers< ::capnp::List< ::capnp::List< ::capnp::compiler::Token>>>::disown(
_builder, 0 * ::capnp::POINTERS); _builder, 0 * ::capnp::POINTERS);
} }
inline bool Token::Reader::hasStartByte() const {
return _reader.hasDataField< ::uint32_t>(1 * ::capnp::ELEMENTS);
}
inline bool Token::Builder::hasStartByte() {
return _builder.hasDataField< ::uint32_t>(1 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Reader::getStartByte() const {
return _reader.getDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Builder::getStartByte() {
return _builder.getDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS);
}
inline void Token::Builder::setStartByte( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
1 * ::capnp::ELEMENTS, value);
}
inline bool Token::Reader::hasEndByte() const {
return _reader.hasDataField< ::uint32_t>(4 * ::capnp::ELEMENTS);
}
inline bool Token::Builder::hasEndByte() {
return _builder.hasDataField< ::uint32_t>(4 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Reader::getEndByte() const {
return _reader.getDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS);
}
inline ::uint32_t Token::Builder::getEndByte() {
return _builder.getDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS);
}
inline void Token::Builder::setEndByte( ::uint32_t value) {
_builder.setDataField< ::uint32_t>(
4 * ::capnp::ELEMENTS, value);
}
inline bool Statement::Reader::hasTokens() const { inline bool Statement::Reader::hasTokens() const {
return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS); return !_reader.isPointerFieldNull(0 * ::capnp::POINTERS);
} }
......
...@@ -186,12 +186,11 @@ struct Located { ...@@ -186,12 +186,11 @@ struct Located {
// ======================================================================================= // =======================================================================================
template <typename T, Token::Body::Which type, T (Token::Body::Reader::*get)() const> template <typename T, Token::Which type, T (Token::Reader::*get)() const>
struct MatchTokenType { struct MatchTokenType {
kj::Maybe<Located<T>> operator()(Token::Reader token) const { kj::Maybe<Located<T>> operator()(Token::Reader token) const {
auto body = token.getBody(); if (token.which() == type) {
if (body.which() == type) { return Located<T>((token.*get)(), token.getStartByte(), token.getEndByte());
return Located<T>((body.*get)(), token.getStartByte(), token.getEndByte());
} else { } else {
return nullptr; return nullptr;
} }
...@@ -200,7 +199,7 @@ struct MatchTokenType { ...@@ -200,7 +199,7 @@ struct MatchTokenType {
#define TOKEN_TYPE_PARSER(type, discrim, getter) \ #define TOKEN_TYPE_PARSER(type, discrim, getter) \
p::transformOrReject(p::any, \ p::transformOrReject(p::any, \
MatchTokenType<type, Token::Body::discrim, &Token::Body::Reader::getter>()) MatchTokenType<type, Token::discrim, &Token::Reader::getter>())
constexpr auto identifier = TOKEN_TYPE_PARSER(Text::Reader, IDENTIFIER, getIdentifier); constexpr auto identifier = TOKEN_TYPE_PARSER(Text::Reader, IDENTIFIER, getIdentifier);
constexpr auto stringLiteral = TOKEN_TYPE_PARSER(Text::Reader, STRING_LITERAL, getStringLiteral); constexpr auto stringLiteral = TOKEN_TYPE_PARSER(Text::Reader, STRING_LITERAL, getStringLiteral);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment