Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- and (|IdentifierDefinition|_|) tokens =
- let rec parseIdentifierTuple tokens (cont:IdentifierDefinition list) =
- match tokens with
- | Token.LParen (row,col) :: remainingTokens ->
- let remainingTokens,tuple = parseIdentifierTuple remainingTokens []
- let remainingTokens,RHS = parseIdentifierTuple remainingTokens (cont @ [IdentifierDefinition.TupleIdentifier tuple])
- (remainingTokens, RHS)
- | Token.Identifier (name,row,col) :: remainingTokens ->
- let identifier = IdentifierDefinition.Identifier (name,Unknown)
- match remainingTokens with
- | Token.Comma (row,col) :: remainingTokens ->
- match remainingTokens with
- | Token.Identifier _ :: _ | Token.LParen _ :: _ -> ()
- | _ -> failwith <| errorMessage codeLines.[row] row col "Unexpected token after comma"
- let remainingTokens,cont = parseIdentifierTuple remainingTokens (cont @ [identifier])
- (remainingTokens,cont)
- | Token.RParen (row,col) :: remainingTokens ->
- match remainingTokens with
- | Token.Comma (row,col) :: remainingTokens -> (remainingTokens,cont @ [identifier])
- | _ -> (remainingTokens,cont @ [identifier])
- | _ ->
- failwith <| errorMessage codeLines.[row] row col ("Unexpected token after " + name)
- | Token.RParen (row,col) :: remainingTokens ->
- (remainingTokens,cont)
- match tokens with
- | Token.LParen (row,col) :: remainingTokens ->
- let remainingTokens,tuple = parseIdentifierTuple remainingTokens []
- Some <| (remainingTokens, IdentifierDefinition.TupleIdentifier tuple)
- | Token.Identifier (name,row,col) :: remainingTokens->
- Some (remainingTokens, IdentifierDefinition.Identifier (name,Unknown))
- | _ -> None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement