Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[fix] compiler, parser(js): Fix js syntax for database declaration

  • Loading branch information...
commit 29c167a91faa656927a19da6b52b806e85b56871 1 parent 9a2af08
@BourgerieQuentin BourgerieQuentin authored
Showing with 16 additions and 21 deletions.
  1. +16 −21 opalang/js_syntax/opa_parser.trx
View
37 opalang/js_syntax/opa_parser.trx
@@ -435,32 +435,27 @@ database_network_port <- Opa_lexer.colon_nosp Opa_lexer.int:p {{ p }}
declaration_database <-
/ Opa_lexer.DATABASE database_pathdef:def
{{ List.map (function e -> NewDbDef e) def }}
- / Opa_lexer.DATABASE spacing (ml_identifier:id spacing db_options?:opt {{id, opt}})?:decl
+ / Opa_lexer.DATABASE spacing ml_identifier:id spacing db_options?:opt
spacing database_body:body
{{
- let decl_ = match decl with
- | None -> []
- | Some (id, opt) ->
- let opt = match opt with
- | None -> []
- | Some opt -> opt in
- [Database (id, [], opt)]
+ let decl_ =
+ let opt = match opt with
+ | None -> []
+ | Some opt -> opt in
+ [Database (id, [id], opt)]
in
let bodymap =
let construct e = NewDbDef e in
- match decl with
- | None -> construct
- | Some (id, _) ->
- let prefix p = QmlAst.Db.Decl_fld id :: p in
- function e ->
- construct
- (match e with
- | QmlAst.Db.Db_TypeDecl (p, a) -> QmlAst.Db.Db_TypeDecl (prefix p, a)
- | QmlAst.Db.Db_Default (p, a) -> QmlAst.Db.Db_Default (prefix p, a)
- | QmlAst.Db.Db_Alias (p, a) -> QmlAst.Db.Db_Alias (prefix p, a)
- | QmlAst.Db.Db_Constraint (p, a) -> QmlAst.Db.Db_Constraint (prefix p, a)
- | QmlAst.Db.Db_Virtual (p, a) -> QmlAst.Db.Db_Virtual (prefix p, a)
- )
+ let prefix p = QmlAst.Db.Decl_fld id :: p in
+ function e ->
+ construct
+ (match e with
+ | QmlAst.Db.Db_TypeDecl (p, a) -> QmlAst.Db.Db_TypeDecl (prefix p, a)
+ | QmlAst.Db.Db_Default (p, a) -> QmlAst.Db.Db_Default (prefix p, a)
+ | QmlAst.Db.Db_Alias (p, a) -> QmlAst.Db.Db_Alias (prefix p, a)
+ | QmlAst.Db.Db_Constraint (p, a) -> QmlAst.Db.Db_Constraint (prefix p, a)
+ | QmlAst.Db.Db_Virtual (p, a) -> QmlAst.Db.Db_Virtual (prefix p, a)
+ )
in
decl_ @ List.map bodymap body
}}
Please sign in to comment.
Something went wrong with that request. Please try again.