You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
659 B
18 lines
659 B
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Parse.Python () where
|
|
|
|
-- Responsible for parsing python import statements
|
|
|
|
{-
|
|
- import_stmt: import_name | import_from
|
|
- import_name: 'import' dotted_as_names
|
|
- note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
|
|
- import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
|
|
- 'import' ('*' | '(' import_as_names ')' | import_as_names))
|
|
- import_as_name: NAME ['as' NAME]
|
|
- dotted_as_name: dotted_name ['as' NAME]
|
|
- import_as_names: import_as_name (',' import_as_name)* [',']
|
|
- dotted_as_names: dotted_as_name (',' dotted_as_name)*
|
|
- dotted_name: NAME ('.' NAME)*
|
|
-}
|
|
|