-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsqnb
1 lines (1 loc) · 9.1 KB
/
tsqnb
1
{"cells":[{"code":"# Metavars\n## At function scope","language":"markdown","kind":"markdown"},{"code":"int main(){\n [[META::var(5)]];\n}","language":"cpp","kind":"code"},{"code":"(function_definition\n (compound_statement\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier) @name\n name: (identifier) @generator\n (argument_list)? @arguments \n ))+\n (expression_statement \";\")) @node\n))","language":"scm","kind":"code"},{"code":"## At file scope","language":"markdown","kind":"markdown"},{"code":"[[META::var(5)]];\nint main(){}","language":"cpp","kind":"code"},{"code":"(translation_unit (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier) @name\n name: (identifier) @generator\n (argument_list)? @arguments \n ))+\n (expression_statement \";\")) @node)","language":"scm","kind":"code"},{"code":"## At namespace scope","language":"markdown","kind":"markdown"},{"code":"namespace Foo {\n[[META::var(5)]];\n}","language":"cpp","kind":"code"},{"code":"(namespace_definition \n body: (declaration_list\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier) @name\n name: (identifier) @generator\n (argument_list)? @arguments \n ))+\n (expression_statement \";\")) @node\n))","language":"scm","kind":"code"},{"code":"# Vars","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[benchmark(\"type_at\")]] {\n [[STRATEGY::var(\"recursive\", \"nested\", \"paging\", /*, \"cpp26\"*/)]];\n [[COUNT::range(0, 255)]];\n }\n}","language":"cpp","kind":"code"},{"code":"(attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier) @name\n name: (identifier) @generator\n (argument_list)? @arguments \n ))+\n (expression_statement \";\")) @node","language":"scm","kind":"code"},{"code":"## Config","language":"markdown","kind":"markdown"},{"code":"[[standard(\">=26\")]];\nint main() {}","language":"cpp","kind":"code"},{"code":"(translation_unit (attributed_statement\n (attribute_declaration\n (attribute\n name: (identifier) @setting\n (argument_list) @arguments \n ))+\n (expression_statement \";\")) @node)","language":"scm","kind":"code"},{"code":"## Config at any scope","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[benchmark(\"foo\")]]{\n [[standard('>=26')]];\n }\n}","language":"cpp","kind":"code"},{"code":"(attributed_statement\n (attribute_declaration\n (attribute\n name: (identifier) @setting\n (argument_list) @arguments \n))+\n(expression_statement \";\")) @node","language":"scm","kind":"code"},{"code":"# Tests","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[benchmark(\"foo\")]]{\n // ...\n }\n\n [[test(\"bar\")]] {\n // ...\n }\n}","language":"cpp","kind":"code"},{"code":"\n(attributed_statement \n (attribute_declaration\n (attribute\n name: (identifier) @kind (.match? @kind \"^(benchmark|test)\")\n (argument_list\n (string_literal \n (string_content) @name))\n ) ) @attributes\n (compound_statement) @code)","language":"scm","kind":"code"},{"code":"# Template parameter","language":"markdown","kind":"markdown"},{"code":"template <int [[foo]] nttp1, int nttp2 [[foo]]>\nvoid zoinks(){}","language":"cpp","kind":"code"},{"code":"\n(template_declaration\n parameters: (template_parameter_list \n (parameter_declaration\n type: (_) @type\n ([\n (attributed_declarator \n (identifier) @ident \n (attribute_declaration) @attr) \n (\n (attribute_declaration) @attr \n (identifier) @ident)])) @decl))","language":"scm","kind":"code"},{"code":"# Using directive","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[foo]] using namespace bar;\n}","language":"cpp","kind":"code"},{"code":"(declaration \n (attribute_declaration (_) @attr_content) @attr\n type: (type_identifier) @type (.eq? @type \"using\")\n declarator: (identifier) @name (.eq? @name \"namespace\")\n) @decl","language":"scm","kind":"code"},{"code":"","language":"markdown","kind":"markdown"},{"code":"[[standard('20')]];\n[[GLOBAL::var(1)]];\n\nint main() {\n [[FUNCTION::var(2)]];\n [[benchmark(\"foo\")]] {\n [[standard('>=26')]];\n [[VAR::var(5)]];\n }\n}","language":"cpp","kind":"code"},{"code":"(translation_unit \n [\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier)? @prefix\n name: (identifier) @name\n (argument_list)? @arguments \n )\n )+\n (expression_statement \";\")) @node\n\n (namespace_definition \n body: (declaration_list\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier)? @prefix\n name: (identifier) @name\n (argument_list)? @arguments \n )\n )+\n (expression_statement \";\")) @node\n ))\n\n (function_definition\n (compound_statement\n [\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier)? @prefix\n name: (identifier) @name\n (argument_list)? @arguments \n )\n )+\n (expression_statement \";\")) @node\n\n (attributed_statement \n (attribute_declaration\n (attribute\n name: (identifier) @kind (.match? @kind \"^(benchmark|test)\")\n (argument_list (string_literal (string_content) @name))\n ) ) @attributes\n (compound_statement\n (attributed_statement\n (attribute_declaration\n (attribute\n prefix: (identifier)? @prefix\n name: (identifier) @name\n (argument_list)? @arguments \n )\n )+\n (expression_statement \";\")) @node\n ) @code)\n ]\n )\n )\n ]\n)","language":"scm","kind":"code"},{"code":"# Identifiers","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[benchmark(\"type_at\")]] {\n [[STRATEGY::var(\"recursive\", \"inheritance1\", \"inheritance2\", \"voidptr\", \"ignored\", \"nested\", \"paging\", \"builtin\" /*, \"cpp26\"*/)]];\n [[COUNT::range(0, 255)]];\n\n run<STRATEGY::get>(std::make_index_sequence<COUNT>{});\n }\n}","language":"cpp","kind":"code"},{"code":"(identifier) @ident","language":"scm","kind":"code"},{"code":"# Attribute using","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[using multiply: x, y, mul(x, y)]];\n [[using pi: var(3)]];\n [[using ip: pi]];\n}","language":"cpp","kind":"code"},{"code":"(attributed_statement\n (attribute_declaration \n (attribute name: ((identifier) @ident) (.eq? @ident \"using\") )\n )\n .\n (labeled_statement\n label: (statement_identifier) @name\n (expression_statement\n [\n (comma_expression) @function\n (call_expression) @value\n (identifier) @value\n ]\n )\n )\n) @node","language":"scm","kind":"code"},{"code":"# global var","language":"markdown","kind":"markdown"},{"code":"auto _ = 3;","language":"cpp","kind":"code"},{"code":"(translation_unit \n (declaration type: \n (placeholder_type_specifier (auto)) \n declarator: \n (init_declarator \n declarator: (identifier) \n value: (_) @value)\n )\n)","language":"scm","kind":"code"},{"code":"# plot","language":"markdown","kind":"markdown"},{"code":"int main() {\n [[benchmark(\"foo\")]]{\n [[plot]] {\n [[y_axis(result.elapsed_ms)]];\n }\n }\n}","language":"cpp","kind":"code"},{"code":"(attributed_statement \n (attribute_declaration\n (attribute\n name: (identifier) @kind (.match? @kind \"^(plot)\")\n )) @attributes\n (compound_statement) @parameters)","language":"scm","kind":"code"}]}