parser: $if blocks for headers

pull/4072/head
Alexander Medvednikov 2020-03-19 07:59:01 +01:00
parent f798a0937a
commit 3dc3b11435
3 changed files with 8 additions and 3 deletions

View File

@ -4,8 +4,7 @@ import os
#include <sys/ioctl.h> #include <sys/ioctl.h>
$if solaris $if solaris {
{
#include <unistd.h> // ioctl #include <unistd.h> // ioctl
#include <sys/termios.h> // TIOCGWINSZ #include <sys/termios.h> // TIOCGWINSZ
} }

View File

@ -614,7 +614,7 @@ fn (g mut Gen) expr(node ast.Expr) {
} }
} }
ast.Assoc { ast.Assoc {
g.write('/* assoc */') g.assoc(it)
} }
ast.BoolLiteral { ast.BoolLiteral {
g.write(it.val.str()) g.write(it.val.str())
@ -1348,6 +1348,9 @@ fn (g mut Gen) const_decl(node ast.ConstDecl) {
} }
} }
// { user | name: 'new name' }
fn (g mut Gen) assoc(node ast.Assoc) {}
fn (g mut Gen) call_args(args []ast.CallArg) { fn (g mut Gen) call_args(args []ast.CallArg) {
for i, arg in args { for i, arg in args {
if table.type_is_variadic(arg.expected_type) { if table.type_is_variadic(arg.expected_type) {

View File

@ -370,6 +370,9 @@ pub fn (p mut Parser) stmt() ast.Stmt {
stmts: stmts stmts: stmts
} }
} }
.hash {
return p.hash()
}
.key_defer { .key_defer {
p.next() p.next()
stmts := p.parse_block() stmts := p.parse_block()