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