mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: more permissive structure names, that allow URL as a struct name
This commit is contained in:
parent
900a18f955
commit
589b932f19
@ -661,11 +661,11 @@ pub fn (p mut Parser) name_expr() ast.Expr {
|
|||||||
x := p.call_expr(is_c, mod) // TODO `node,typ :=` should work
|
x := p.call_expr(is_c, mod) // TODO `node,typ :=` should work
|
||||||
node = x
|
node = x
|
||||||
}
|
}
|
||||||
} else if p.peek_tok.kind == .lcbr && (p.tok.lit[0].is_capital() || is_c || (p.builtin_mod &&
|
} else if p.peek_tok.kind == .lcbr && !p.inside_match_case &&
|
||||||
p.tok.lit in table.builtin_type_names)) && (p.tok.lit.len in [1, 2] || !p.tok.lit[p.tok.lit.len -
|
( is_c || p.tok.lit[0].is_capital() || (p.builtin_mod && p.tok.lit in table.builtin_type_names) ) &&
|
||||||
1].is_capital()) && !p.inside_match_case {
|
( p.tok.lit.len in [1, 2, 3] || !p.tok.lit[p.tok.lit.len - 1].is_capital() || p.table.known_type(p.tok.lit) ) {
|
||||||
// || p.table.known_type(p.tok.lit)) {
|
// short_syntax: false
|
||||||
return p.struct_init(false) // short_syntax: false
|
return p.struct_init(false)
|
||||||
} else if p.peek_tok.kind == .dot && (p.tok.lit[0].is_capital() && !known_var) {
|
} else if p.peek_tok.kind == .dot && (p.tok.lit[0].is_capital() && !known_var) {
|
||||||
// `Color.green`
|
// `Color.green`
|
||||||
mut enum_name := p.check_name()
|
mut enum_name := p.check_name()
|
||||||
|
Loading…
Reference in New Issue
Block a user