Wrote some files
This commit is contained in:
parent
e82ec1ce09
commit
33d28566ad
11 changed files with 333 additions and 60 deletions
26
src/PrimaryExpression.hs
Normal file
26
src/PrimaryExpression.hs
Normal file
|
@ -0,0 +1,26 @@
|
|||
module PrimaryExpression (PrimaryExpression(..) ) where
|
||||
|
||||
import qualified Data.List as List
|
||||
|
||||
import ClassLiteral (ClassLiteral)
|
||||
import JavaLanguage (m_identifier)
|
||||
import LiteralExpression (LiteralExpression)
|
||||
|
||||
import Text.Parsec (manyTill, char, string')
|
||||
import Text.Parsec.String (Parser)
|
||||
|
||||
data PrimaryExpression = Literal LiteralExpression
|
||||
| ClassLiteral ClassLiteral
|
||||
| This
|
||||
| TypedThis String
|
||||
| InstanceCreation
|
||||
deriving Show
|
||||
|
||||
parseThis :: Parser PrimaryExpression
|
||||
parseThis = string' "this" *> return This
|
||||
|
||||
parseTypedThis :: Parser PrimaryExpression
|
||||
parseTypedThis = do
|
||||
start <- m_identifier
|
||||
paths <- manyTill (char '.' *> m_identifier) (string' ".this")
|
||||
return . TypedThis . List.intercalate "." $ (start:paths)
|
Loading…
Add table
Add a link
Reference in a new issue