fix v2 parser int.v error
parent
d7a8b1b4f2
commit
82b0024758
|
@ -156,14 +156,18 @@ pub fn (n int) hex() string {
|
||||||
pub fn (n i64) hex() string {
|
pub fn (n i64) hex() string {
|
||||||
len := if n >= 0 { n.str().len + 3 } else { 19 }
|
len := if n >= 0 { n.str().len + 3 } else { 19 }
|
||||||
hex := malloc(len)
|
hex := malloc(len)
|
||||||
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
|
// TODO
|
||||||
|
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
|
||||||
|
count := C.sprintf(charptr(hex), '0x%llx', n)
|
||||||
return tos(hex, count)
|
return tos(hex, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (n u64) hex() string {
|
pub fn (n u64) hex() string {
|
||||||
len := if n > 0 { n.str().len + 3 } else { 19 }
|
len := if n > 0 { n.str().len + 3 } else { 19 }
|
||||||
hex := malloc(len)
|
hex := malloc(len)
|
||||||
count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
|
//count := C.sprintf(charptr(hex), '0x%'C.PRIx64, n)
|
||||||
|
count := C.sprintf(charptr(hex), '0x%llx', n)
|
||||||
|
//count := C.sprintf(charptr(hex), '0x%lx', n)
|
||||||
return tos(hex, count)
|
return tos(hex, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,8 @@ import (
|
||||||
pub type Expr = InfixExpr | IfExpr | StringLiteral | IntegerLiteral | CharLiteral |
|
pub type Expr = InfixExpr | IfExpr | StringLiteral | IntegerLiteral | CharLiteral |
|
||||||
FloatLiteral | Ident | CallExpr | BoolLiteral | StructInit | ArrayInit | SelectorExpr | PostfixExpr |
|
FloatLiteral | Ident | CallExpr | BoolLiteral | StructInit | ArrayInit | SelectorExpr | PostfixExpr |
|
||||||
AssignExpr | PrefixExpr | MethodCallExpr | IndexExpr | RangeExpr | MatchExpr |
|
AssignExpr | PrefixExpr | MethodCallExpr | IndexExpr | RangeExpr | MatchExpr |
|
||||||
CastExpr | EnumVal | Assoc | SizeOf | None | MapInit | IfGuardExpr | ParExpr | OrExpr
|
CastExpr | EnumVal | Assoc | SizeOf | None | MapInit | IfGuardExpr | ParExpr | OrExpr |
|
||||||
|
ConcatExpr
|
||||||
|
|
||||||
pub type Stmt = VarDecl | GlobalDecl | FnDecl | Return | Module | Import | ExprStmt |
|
pub type Stmt = VarDecl | GlobalDecl | FnDecl | Return | Module | Import | ExprStmt |
|
||||||
ForStmt | StructDecl | ForCStmt | ForInStmt | CompIf | ConstDecl | Attr | BranchStmt |
|
ForStmt | StructDecl | ForCStmt | ForInStmt | CompIf | ConstDecl | Attr | BranchStmt |
|
||||||
|
@ -535,6 +536,11 @@ pub:
|
||||||
text string
|
text string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct ConcatExpr {
|
||||||
|
pub:
|
||||||
|
vals []Expr
|
||||||
|
}
|
||||||
|
|
||||||
pub struct None {
|
pub struct None {
|
||||||
pub:
|
pub:
|
||||||
foo int // todo
|
foo int // todo
|
||||||
|
|
|
@ -439,11 +439,16 @@ fn (c mut Checker) stmt(node ast.Stmt) {
|
||||||
it.typ = typ
|
it.typ = typ
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
println('checker.stmt(): unhandled node')
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
println('1')
|
||||||
node_name := typeof(node)
|
node_name := typeof(node)
|
||||||
if !(node_name) in c.unhandled_stmts {
|
println('2')
|
||||||
|
if !(node_name in c.unhandled_stmts) {
|
||||||
c.unhandled_stmts << node_name
|
c.unhandled_stmts << node_name
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue