vfmt: enum fix
parent
6af54d0207
commit
00b8a5d3e4
|
@ -35,12 +35,13 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
p.warn('enum values cannot contain uppercase letters, use snake_case instead')
|
||||
}
|
||||
fields << field
|
||||
p.fgen_nl()
|
||||
name := '${mod_gen_name(p.mod)}__${enum_name}_$field'
|
||||
if p.tok == .assign {
|
||||
p.fspace()
|
||||
mut enum_assign_tidx := p.cur_tok_index()
|
||||
if p.peek() == .number {
|
||||
p.next()
|
||||
p.fspace()
|
||||
val = p.lit.int()
|
||||
p.next()
|
||||
}
|
||||
|
@ -56,6 +57,7 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
if p.tok == .comma {
|
||||
p.next()
|
||||
}
|
||||
p.fgen_nl()
|
||||
val++
|
||||
}
|
||||
is_flag := p.attr == 'flag'
|
||||
|
@ -76,7 +78,8 @@ fn (p mut Parser) enum_decl(no_name bool) {
|
|||
}
|
||||
p.table.register_type(T)
|
||||
p.check(.rcbr)
|
||||
p.fgenln('\n')
|
||||
p.fgen_nl()
|
||||
p.fgen_nl()
|
||||
}
|
||||
|
||||
fn (p mut Parser) check_enum_member_access() {
|
||||
|
|
|
@ -16,8 +16,8 @@ struct MsvcResult {
|
|||
vs_include_path string
|
||||
shared_include_path string
|
||||
}
|
||||
// shell32 for RegOpenKeyExW etc
|
||||
|
||||
// shell32 for RegOpenKeyExW etc
|
||||
// Mimics a HKEY
|
||||
type RegKey voidptr
|
||||
// Taken from the windows SDK
|
||||
|
|
|
@ -123,8 +123,6 @@ enum TokenKind {
|
|||
|
||||
// build_keys genereates a map with keywords' string values:
|
||||
// Keywords['return'] == .key_return
|
||||
|
||||
|
||||
fn build_keys() map[string]int {
|
||||
mut res := map[string]int
|
||||
for t := int(TokenKind.keyword_beg) + 1; t < int(TokenKind.keyword_end); t++ {
|
||||
|
|
|
@ -11,12 +11,12 @@ But it will be necessary once we have dynamic linking.
|
|||
|
||||
|
||||
enum SectionType {
|
||||
null
|
||||
=0progbits
|
||||
=1symtab
|
||||
=2strtab
|
||||
=3rela
|
||||
=4}
|
||||
null = 0
|
||||
progbits = 1
|
||||
symtab = 2
|
||||
strtab = 3
|
||||
rela = 4
|
||||
}
|
||||
|
||||
struct SectionConfig {
|
||||
name string
|
||||
|
|
Loading…
Reference in New Issue