v2: xor, for x = ...

pull/3800/head
Alexander Medvednikov 2020-02-20 20:30:34 +01:00
parent c85ccad0a6
commit e56bf42270
3 changed files with 9 additions and 3 deletions

View File

@ -108,7 +108,10 @@ fn (m mut map) set(key string, value voidptr) {
// Match is not possible anymore.
// Probe until an empty index is found.
// Swap when probe count is higher/richer (Robin Hood).
mut current_kv := KeyValue{key, malloc(m.value_bytes)}
mut current_kv := KeyValue{
key:key
value:malloc(m.value_bytes)
}
C.memcpy(current_kv.value, value, m.value_bytes)
for m.probe_hash[index] != 0 {
if probe_hash > m.probe_hash[index] {

View File

@ -917,6 +917,9 @@ fn (p mut Parser) for_statement() ast.Stmt {
if p.peek_tok.kind == .decl_assign {
init = p.var_decl()
}
else if p.peek_tok.kind == .assign {
init = p.assign_stmt()
}
else if p.tok.kind != .semicolon {}
// allow `for ;; i++ {`
// Allow `for i = 0; i < ...`

View File

@ -480,7 +480,7 @@ pub fn (k Kind) is_start_of_type() bool {
pub fn (kind Kind) is_infix() bool {
return kind in [.plus, .minus, .mod, .mul, .div, .eq, .ne, .gt, .lt, .key_in,
//
.key_as, .ge, .le, .logical_or,
.key_as, .ge, .le, .logical_or, .xor,
//
.and, .dot, .pipe, .amp, .left_shift, .right_shift]
}