Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
2e3f671c
Commit
2e3f671c
authored
Feb 16, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class -> struct
parent
22a75445
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
54 deletions
+54
-54
Compiler.hs
compiler/src/Compiler.hs
+19
-19
Grammar.hs
compiler/src/Grammar.hs
+1
-1
Lexer.hs
compiler/src/Lexer.hs
+1
-1
Parser.hs
compiler/src/Parser.hs
+9
-9
Semantics.hs
compiler/src/Semantics.hs
+23
-23
Token.hs
compiler/src/Token.hs
+1
-1
No files found.
compiler/src/Compiler.hs
View file @
2e3f671c
...
@@ -105,7 +105,7 @@ statusToMaybe (Failed _) = Nothing
...
@@ -105,7 +105,7 @@ statusToMaybe (Failed _) = Nothing
-- | Look up a direct member of a descriptor by name.
-- | Look up a direct member of a descriptor by name.
descMember
name
(
DescFile
d
)
=
lookupMember
name
(
fileMemberMap
d
)
descMember
name
(
DescFile
d
)
=
lookupMember
name
(
fileMemberMap
d
)
descMember
name
(
DescEnum
d
)
=
lookupMember
name
(
enumMemberMap
d
)
descMember
name
(
DescEnum
d
)
=
lookupMember
name
(
enumMemberMap
d
)
descMember
name
(
Desc
Class
d
)
=
lookupMember
name
(
class
MemberMap
d
)
descMember
name
(
Desc
Struct
d
)
=
lookupMember
name
(
struct
MemberMap
d
)
descMember
name
(
DescInterface
d
)
=
lookupMember
name
(
interfaceMemberMap
d
)
descMember
name
(
DescInterface
d
)
=
lookupMember
name
(
interfaceMemberMap
d
)
descMember
name
(
DescAlias
d
)
=
descMember
name
(
aliasTarget
d
)
descMember
name
(
DescAlias
d
)
=
descMember
name
(
aliasTarget
d
)
descMember
_
_
=
Nothing
descMember
_
_
=
Nothing
...
@@ -191,7 +191,7 @@ compileValue pos (BuiltinType BuiltinText) _ = makeExpectError pos "string"
...
@@ -191,7 +191,7 @@ compileValue pos (BuiltinType BuiltinText) _ = makeExpectError pos "string"
compileValue
pos
(
BuiltinType
BuiltinBytes
)
_
=
makeExpectError
pos
"string"
compileValue
pos
(
BuiltinType
BuiltinBytes
)
_
=
makeExpectError
pos
"string"
compileValue
pos
(
EnumType
_
)
_
=
makeError
pos
"Unimplemented: enum default values"
compileValue
pos
(
EnumType
_
)
_
=
makeError
pos
"Unimplemented: enum default values"
compileValue
pos
(
ClassType
_
)
_
=
makeError
pos
"Unimplemented: class
default values"
compileValue
pos
(
StructType
_
)
_
=
makeError
pos
"Unimplemented: struct
default values"
compileValue
pos
(
InterfaceType
_
)
_
=
makeError
pos
"Interfaces can't have default values."
compileValue
pos
(
InterfaceType
_
)
_
=
makeError
pos
"Interfaces can't have default values."
compileValue
pos
(
ListType
_
)
_
=
makeError
pos
"Unimplemented: array default values"
compileValue
pos
(
ListType
_
)
_
=
makeError
pos
"Unimplemented: array default values"
...
@@ -200,11 +200,11 @@ makeFileMemberMap desc = Map.fromList allMembers where
...
@@ -200,11 +200,11 @@ makeFileMemberMap desc = Map.fromList allMembers where
allMembers
=
[
(
aliasName
m
,
DescAlias
m
)
|
m
<-
fileAliases
desc
]
allMembers
=
[
(
aliasName
m
,
DescAlias
m
)
|
m
<-
fileAliases
desc
]
++
[
(
constantName
m
,
DescConstant
m
)
|
m
<-
fileConstants
desc
]
++
[
(
constantName
m
,
DescConstant
m
)
|
m
<-
fileConstants
desc
]
++
[
(
enumName
m
,
DescEnum
m
)
|
m
<-
fileEnums
desc
]
++
[
(
enumName
m
,
DescEnum
m
)
|
m
<-
fileEnums
desc
]
++
[
(
className
m
,
DescClass
m
)
|
m
<-
fileClasse
s
desc
]
++
[
(
structName
m
,
DescStruct
m
)
|
m
<-
fileStruct
s
desc
]
++
[
(
interfaceName
m
,
DescInterface
m
)
|
m
<-
fileInterfaces
desc
]
++
[
(
interfaceName
m
,
DescInterface
m
)
|
m
<-
fileInterfaces
desc
]
descAsType
_
(
DescEnum
desc
)
=
succeed
(
EnumType
desc
)
descAsType
_
(
DescEnum
desc
)
=
succeed
(
EnumType
desc
)
descAsType
_
(
Desc
Class
desc
)
=
succeed
(
Class
Type
desc
)
descAsType
_
(
Desc
Struct
desc
)
=
succeed
(
Struct
Type
desc
)
descAsType
_
(
DescInterface
desc
)
=
succeed
(
InterfaceType
desc
)
descAsType
_
(
DescInterface
desc
)
=
succeed
(
InterfaceType
desc
)
descAsType
_
(
DescBuiltinType
desc
)
=
succeed
(
BuiltinType
desc
)
descAsType
_
(
DescBuiltinType
desc
)
=
succeed
(
BuiltinType
desc
)
descAsType
name
(
DescAlias
desc
)
=
descAsType
name
(
aliasTarget
desc
)
descAsType
name
(
DescAlias
desc
)
=
descAsType
name
(
aliasTarget
desc
)
...
@@ -286,21 +286,21 @@ compileDecl scope (EnumValueDecl (Located _ name) (Located _ number) decls) =
...
@@ -286,21 +286,21 @@ compileDecl scope (EnumValueDecl (Located _ name) (Located _ number) decls) =
,
enumValueOptions
=
options
,
enumValueOptions
=
options
})))
})))
compileDecl
scope
(
Class
Decl
(
Located
_
name
)
decls
)
=
compileDecl
scope
(
Struct
Decl
(
Located
_
name
)
decls
)
=
CompiledMember
name
(
feedback
(
\
desc
->
do
CompiledMember
name
(
feedback
(
\
desc
->
do
(
members
,
memberMap
,
options
)
<-
compileChildDecls
desc
decls
(
members
,
memberMap
,
options
)
<-
compileChildDecls
desc
decls
return
(
Desc
Class
Class
Desc
return
(
Desc
Struct
Struct
Desc
{
class
Name
=
name
{
struct
Name
=
name
,
class
Parent
=
scope
,
struct
Parent
=
scope
,
class
Fields
=
[
d
|
DescField
d
<-
members
]
,
struct
Fields
=
[
d
|
DescField
d
<-
members
]
,
class
NestedAliases
=
[
d
|
DescAlias
d
<-
members
]
,
struct
NestedAliases
=
[
d
|
DescAlias
d
<-
members
]
,
class
NestedConstants
=
[
d
|
DescConstant
d
<-
members
]
,
struct
NestedConstants
=
[
d
|
DescConstant
d
<-
members
]
,
class
NestedEnums
=
[
d
|
DescEnum
d
<-
members
]
,
struct
NestedEnums
=
[
d
|
DescEnum
d
<-
members
]
,
classNestedClasses
=
[
d
|
DescClass
d
<-
members
]
,
structNestedStructs
=
[
d
|
DescStruct
d
<-
members
]
,
class
NestedInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
struct
NestedInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
class
Options
=
options
,
struct
Options
=
options
,
class
Members
=
members
,
struct
Members
=
members
,
class
MemberMap
=
memberMap
,
struct
MemberMap
=
memberMap
})))
})))
compileDecl
scope
(
FieldDecl
(
Located
_
name
)
(
Located
_
number
)
typeExp
defaultValue
decls
)
=
compileDecl
scope
(
FieldDecl
(
Located
_
name
)
(
Located
_
number
)
typeExp
defaultValue
decls
)
=
...
@@ -329,7 +329,7 @@ compileDecl scope (InterfaceDecl (Located _ name) decls) =
...
@@ -329,7 +329,7 @@ compileDecl scope (InterfaceDecl (Located _ name) decls) =
,
interfaceNestedAliases
=
[
d
|
DescAlias
d
<-
members
]
,
interfaceNestedAliases
=
[
d
|
DescAlias
d
<-
members
]
,
interfaceNestedConstants
=
[
d
|
DescConstant
d
<-
members
]
,
interfaceNestedConstants
=
[
d
|
DescConstant
d
<-
members
]
,
interfaceNestedEnums
=
[
d
|
DescEnum
d
<-
members
]
,
interfaceNestedEnums
=
[
d
|
DescEnum
d
<-
members
]
,
interfaceNested
Classes
=
[
d
|
DescClass
d
<-
members
]
,
interfaceNested
Structs
=
[
d
|
DescStruct
d
<-
members
]
,
interfaceNestedInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
interfaceNestedInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
interfaceOptions
=
options
,
interfaceOptions
=
options
,
interfaceMembers
=
members
,
interfaceMembers
=
members
...
@@ -378,7 +378,7 @@ compileFile name decls =
...
@@ -378,7 +378,7 @@ compileFile name decls =
,
fileAliases
=
[
d
|
DescAlias
d
<-
members
]
,
fileAliases
=
[
d
|
DescAlias
d
<-
members
]
,
fileConstants
=
[
d
|
DescConstant
d
<-
members
]
,
fileConstants
=
[
d
|
DescConstant
d
<-
members
]
,
fileEnums
=
[
d
|
DescEnum
d
<-
members
]
,
fileEnums
=
[
d
|
DescEnum
d
<-
members
]
,
file
Classes
=
[
d
|
DescClass
d
<-
members
]
,
file
Structs
=
[
d
|
DescStruct
d
<-
members
]
,
fileInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
fileInterfaces
=
[
d
|
DescInterface
d
<-
members
]
,
fileOptions
=
options
,
fileOptions
=
options
,
fileMembers
=
members
,
fileMembers
=
members
...
...
compiler/src/Grammar.hs
View file @
2e3f671c
...
@@ -47,7 +47,7 @@ data Declaration = AliasDecl (Located String) DeclName
...
@@ -47,7 +47,7 @@ data Declaration = AliasDecl (Located String) DeclName
|
ConstantDecl
(
Located
String
)
TypeExpression
(
Located
FieldValue
)
|
ConstantDecl
(
Located
String
)
TypeExpression
(
Located
FieldValue
)
|
EnumDecl
(
Located
String
)
[
Declaration
]
|
EnumDecl
(
Located
String
)
[
Declaration
]
|
EnumValueDecl
(
Located
String
)
(
Located
Integer
)
[
Declaration
]
|
EnumValueDecl
(
Located
String
)
(
Located
Integer
)
[
Declaration
]
|
Class
Decl
(
Located
String
)
[
Declaration
]
|
Struct
Decl
(
Located
String
)
[
Declaration
]
|
FieldDecl
(
Located
String
)
(
Located
Integer
)
|
FieldDecl
(
Located
String
)
(
Located
Integer
)
TypeExpression
(
Maybe
(
Located
FieldValue
))
[
Declaration
]
TypeExpression
(
Maybe
(
Located
FieldValue
))
[
Declaration
]
|
InterfaceDecl
(
Located
String
)
[
Declaration
]
|
InterfaceDecl
(
Located
String
)
[
Declaration
]
...
...
compiler/src/Lexer.hs
View file @
2e3f671c
...
@@ -35,7 +35,7 @@ keywords =
...
@@ -35,7 +35,7 @@ keywords =
,
(
UsingKeyword
,
"using"
)
,
(
UsingKeyword
,
"using"
)
,
(
ConstKeyword
,
"const"
)
,
(
ConstKeyword
,
"const"
)
,
(
EnumKeyword
,
"enum"
)
,
(
EnumKeyword
,
"enum"
)
,
(
ClassKeyword
,
"class
"
)
,
(
StructKeyword
,
"struct
"
)
,
(
InterfaceKeyword
,
"interface"
)
,
(
InterfaceKeyword
,
"interface"
)
,
(
OptionKeyword
,
"option"
)
,
(
OptionKeyword
,
"option"
)
]
]
...
...
compiler/src/Parser.hs
View file @
2e3f671c
...
@@ -62,7 +62,7 @@ importKeyword = tokenParser (matchSimpleToken ImportKeyword)
...
@@ -62,7 +62,7 @@ importKeyword = tokenParser (matchSimpleToken ImportKeyword)
usingKeyword
=
tokenParser
(
matchSimpleToken
UsingKeyword
)
usingKeyword
=
tokenParser
(
matchSimpleToken
UsingKeyword
)
constKeyword
=
tokenParser
(
matchSimpleToken
ConstKeyword
)
constKeyword
=
tokenParser
(
matchSimpleToken
ConstKeyword
)
enumKeyword
=
tokenParser
(
matchSimpleToken
EnumKeyword
)
enumKeyword
=
tokenParser
(
matchSimpleToken
EnumKeyword
)
classKeyword
=
tokenParser
(
matchSimpleToken
Class
Keyword
)
structKeyword
=
tokenParser
(
matchSimpleToken
Struct
Keyword
)
interfaceKeyword
=
tokenParser
(
matchSimpleToken
InterfaceKeyword
)
interfaceKeyword
=
tokenParser
(
matchSimpleToken
InterfaceKeyword
)
optionKeyword
=
tokenParser
(
matchSimpleToken
OptionKeyword
)
optionKeyword
=
tokenParser
(
matchSimpleToken
OptionKeyword
)
...
@@ -111,7 +111,7 @@ constantDecl = do
...
@@ -111,7 +111,7 @@ constantDecl = do
return
(
ConstantDecl
name
typeName
value
)
return
(
ConstantDecl
name
typeName
value
)
typeDecl
statements
=
enumDecl
statements
typeDecl
statements
=
enumDecl
statements
<|>
class
Decl
statements
<|>
struct
Decl
statements
<|>
interfaceDecl
statements
<|>
interfaceDecl
statements
enumDecl
statements
=
do
enumDecl
statements
=
do
...
@@ -135,15 +135,15 @@ enumValueLine :: Maybe [Located Statement] -> TokenParser Declaration
...
@@ -135,15 +135,15 @@ enumValueLine :: Maybe [Located Statement] -> TokenParser Declaration
enumValueLine
Nothing
=
optionDecl
enumValueLine
Nothing
=
optionDecl
enumValueLine
(
Just
_
)
=
fail
"Blocks not allowed here."
enumValueLine
(
Just
_
)
=
fail
"Blocks not allowed here."
class
Decl
statements
=
do
struct
Decl
statements
=
do
class
Keyword
struct
Keyword
name
<-
located
identifier
name
<-
located
identifier
children
<-
parseBlock
class
Line
statements
children
<-
parseBlock
struct
Line
statements
return
(
Class
Decl
name
children
)
return
(
Struct
Decl
name
children
)
class
Line
::
Maybe
[
Located
Statement
]
->
TokenParser
Declaration
struct
Line
::
Maybe
[
Located
Statement
]
->
TokenParser
Declaration
class
Line
Nothing
=
optionDecl
<|>
constantDecl
<|>
fieldDecl
[]
struct
Line
Nothing
=
optionDecl
<|>
constantDecl
<|>
fieldDecl
[]
class
Line
(
Just
statements
)
=
typeDecl
statements
<|>
fieldDecl
statements
struct
Line
(
Just
statements
)
=
typeDecl
statements
<|>
fieldDecl
statements
fieldDecl
statements
=
do
fieldDecl
statements
=
do
name
<-
located
identifier
name
<-
located
identifier
...
...
compiler/src/Semantics.hs
View file @
2e3f671c
...
@@ -38,7 +38,7 @@ data Desc = DescFile FileDesc
...
@@ -38,7 +38,7 @@ data Desc = DescFile FileDesc
|
DescConstant
ConstantDesc
|
DescConstant
ConstantDesc
|
DescEnum
EnumDesc
|
DescEnum
EnumDesc
|
DescEnumValue
EnumValueDesc
|
DescEnumValue
EnumValueDesc
|
Desc
Class
Class
Desc
|
Desc
Struct
Struct
Desc
|
DescField
FieldDesc
|
DescField
FieldDesc
|
DescInterface
InterfaceDesc
|
DescInterface
InterfaceDesc
|
DescMethod
MethodDesc
|
DescMethod
MethodDesc
...
@@ -51,7 +51,7 @@ descName (DescAlias d) = aliasName d
...
@@ -51,7 +51,7 @@ descName (DescAlias d) = aliasName d
descName
(
DescConstant
d
)
=
constantName
d
descName
(
DescConstant
d
)
=
constantName
d
descName
(
DescEnum
d
)
=
enumName
d
descName
(
DescEnum
d
)
=
enumName
d
descName
(
DescEnumValue
d
)
=
enumValueName
d
descName
(
DescEnumValue
d
)
=
enumValueName
d
descName
(
Desc
Class
d
)
=
class
Name
d
descName
(
Desc
Struct
d
)
=
struct
Name
d
descName
(
DescField
d
)
=
fieldName
d
descName
(
DescField
d
)
=
fieldName
d
descName
(
DescInterface
d
)
=
interfaceName
d
descName
(
DescInterface
d
)
=
interfaceName
d
descName
(
DescMethod
d
)
=
methodName
d
descName
(
DescMethod
d
)
=
methodName
d
...
@@ -64,7 +64,7 @@ descParent (DescAlias d) = aliasParent d
...
@@ -64,7 +64,7 @@ descParent (DescAlias d) = aliasParent d
descParent
(
DescConstant
d
)
=
constantParent
d
descParent
(
DescConstant
d
)
=
constantParent
d
descParent
(
DescEnum
d
)
=
enumParent
d
descParent
(
DescEnum
d
)
=
enumParent
d
descParent
(
DescEnumValue
d
)
=
enumValueParent
d
descParent
(
DescEnumValue
d
)
=
enumValueParent
d
descParent
(
Desc
Class
d
)
=
class
Parent
d
descParent
(
Desc
Struct
d
)
=
struct
Parent
d
descParent
(
DescField
d
)
=
fieldParent
d
descParent
(
DescField
d
)
=
fieldParent
d
descParent
(
DescInterface
d
)
=
interfaceParent
d
descParent
(
DescInterface
d
)
=
interfaceParent
d
descParent
(
DescMethod
d
)
=
methodParent
d
descParent
(
DescMethod
d
)
=
methodParent
d
...
@@ -123,7 +123,7 @@ valueString (BytesDesc s) = show (map (chr . fromIntegral) s)
...
@@ -123,7 +123,7 @@ valueString (BytesDesc s) = show (map (chr . fromIntegral) s)
data
TypeDesc
=
BuiltinType
BuiltinType
data
TypeDesc
=
BuiltinType
BuiltinType
|
EnumType
EnumDesc
|
EnumType
EnumDesc
|
ClassType
Class
Desc
|
StructType
Struct
Desc
|
InterfaceType
InterfaceDesc
|
InterfaceType
InterfaceDesc
|
ListType
TypeDesc
|
ListType
TypeDesc
...
@@ -131,7 +131,7 @@ data TypeDesc = BuiltinType BuiltinType
...
@@ -131,7 +131,7 @@ data TypeDesc = BuiltinType BuiltinType
typeName
::
Desc
->
TypeDesc
->
String
typeName
::
Desc
->
TypeDesc
->
String
typeName
_
(
BuiltinType
t
)
=
builtinTypeName
t
-- TODO: Check for shadowing.
typeName
_
(
BuiltinType
t
)
=
builtinTypeName
t
-- TODO: Check for shadowing.
typeName
scope
(
EnumType
desc
)
=
descQualifiedName
scope
(
DescEnum
desc
)
typeName
scope
(
EnumType
desc
)
=
descQualifiedName
scope
(
DescEnum
desc
)
typeName
scope
(
ClassType
desc
)
=
descQualifiedName
scope
(
DescClass
desc
)
typeName
scope
(
StructType
desc
)
=
descQualifiedName
scope
(
DescStruct
desc
)
typeName
scope
(
InterfaceType
desc
)
=
descQualifiedName
scope
(
DescInterface
desc
)
typeName
scope
(
InterfaceType
desc
)
=
descQualifiedName
scope
(
DescInterface
desc
)
typeName
scope
(
ListType
t
)
=
"List("
++
typeName
scope
t
++
")"
typeName
scope
(
ListType
t
)
=
"List("
++
typeName
scope
t
++
")"
...
@@ -159,7 +159,7 @@ data FileDesc = FileDesc
...
@@ -159,7 +159,7 @@ data FileDesc = FileDesc
,
fileAliases
::
[
AliasDesc
]
,
fileAliases
::
[
AliasDesc
]
,
fileConstants
::
[
ConstantDesc
]
,
fileConstants
::
[
ConstantDesc
]
,
fileEnums
::
[
EnumDesc
]
,
fileEnums
::
[
EnumDesc
]
,
file
Classes
::
[
Class
Desc
]
,
file
Structs
::
[
Struct
Desc
]
,
fileInterfaces
::
[
InterfaceDesc
]
,
fileInterfaces
::
[
InterfaceDesc
]
,
fileOptions
::
OptionMap
,
fileOptions
::
OptionMap
,
fileMembers
::
[
Desc
]
,
fileMembers
::
[
Desc
]
...
@@ -196,18 +196,18 @@ data EnumValueDesc = EnumValueDesc
...
@@ -196,18 +196,18 @@ data EnumValueDesc = EnumValueDesc
,
enumValueOptions
::
OptionMap
,
enumValueOptions
::
OptionMap
}
}
data
ClassDesc
=
Class
Desc
data
StructDesc
=
Struct
Desc
{
class
Name
::
String
{
struct
Name
::
String
,
class
Parent
::
Desc
,
struct
Parent
::
Desc
,
class
Fields
::
[
FieldDesc
]
,
struct
Fields
::
[
FieldDesc
]
,
class
NestedAliases
::
[
AliasDesc
]
,
struct
NestedAliases
::
[
AliasDesc
]
,
class
NestedConstants
::
[
ConstantDesc
]
,
struct
NestedConstants
::
[
ConstantDesc
]
,
class
NestedEnums
::
[
EnumDesc
]
,
struct
NestedEnums
::
[
EnumDesc
]
,
classNestedClasses
::
[
Class
Desc
]
,
structNestedStructs
::
[
Struct
Desc
]
,
class
NestedInterfaces
::
[
InterfaceDesc
]
,
struct
NestedInterfaces
::
[
InterfaceDesc
]
,
class
Options
::
OptionMap
,
struct
Options
::
OptionMap
,
class
Members
::
[
Desc
]
,
struct
Members
::
[
Desc
]
,
class
MemberMap
::
MemberMap
,
struct
MemberMap
::
MemberMap
}
}
data
FieldDesc
=
FieldDesc
data
FieldDesc
=
FieldDesc
...
@@ -226,7 +226,7 @@ data InterfaceDesc = InterfaceDesc
...
@@ -226,7 +226,7 @@ data InterfaceDesc = InterfaceDesc
,
interfaceNestedAliases
::
[
AliasDesc
]
,
interfaceNestedAliases
::
[
AliasDesc
]
,
interfaceNestedConstants
::
[
ConstantDesc
]
,
interfaceNestedConstants
::
[
ConstantDesc
]
,
interfaceNestedEnums
::
[
EnumDesc
]
,
interfaceNestedEnums
::
[
EnumDesc
]
,
interfaceNested
Classes
::
[
Class
Desc
]
,
interfaceNested
Structs
::
[
Struct
Desc
]
,
interfaceNestedInterfaces
::
[
InterfaceDesc
]
,
interfaceNestedInterfaces
::
[
InterfaceDesc
]
,
interfaceOptions
::
OptionMap
,
interfaceOptions
::
OptionMap
,
interfaceMembers
::
[
Desc
]
,
interfaceMembers
::
[
Desc
]
...
@@ -273,9 +273,9 @@ descToCode indent (DescEnum desc) = printf "%senum %s {\n%s%s}\n" indent
...
@@ -273,9 +273,9 @@ descToCode indent (DescEnum desc) = printf "%senum %s {\n%s%s}\n" indent
indent
indent
descToCode
indent
(
DescEnumValue
desc
)
=
printf
"%s%s = %d;
\n
"
indent
descToCode
indent
(
DescEnumValue
desc
)
=
printf
"%s%s = %d;
\n
"
indent
(
enumValueName
desc
)
(
enumValueNumber
desc
)
(
enumValueName
desc
)
(
enumValueNumber
desc
)
descToCode
indent
(
Desc
Class
desc
)
=
printf
"%sclass
%s {
\n
%s%s}
\n
"
indent
descToCode
indent
(
Desc
Struct
desc
)
=
printf
"%sstruct
%s {
\n
%s%s}
\n
"
indent
(
class
Name
desc
)
(
struct
Name
desc
)
(
concatMap
(
descToCode
(
" "
++
indent
))
(
class
Members
desc
))
(
concatMap
(
descToCode
(
" "
++
indent
))
(
struct
Members
desc
))
indent
indent
descToCode
indent
(
DescField
desc
)
=
printf
"%s%s@%d: %s%s;
\n
"
indent
descToCode
indent
(
DescField
desc
)
=
printf
"%s%s@%d: %s%s;
\n
"
indent
(
fieldName
desc
)
(
fieldNumber
desc
)
(
fieldName
desc
)
(
fieldNumber
desc
)
...
@@ -303,7 +303,7 @@ instance Show AliasDesc where { show desc = descToCode "" (DescAlias desc) }
...
@@ -303,7 +303,7 @@ instance Show AliasDesc where { show desc = descToCode "" (DescAlias desc) }
instance
Show
ConstantDesc
where
{
show
desc
=
descToCode
""
(
DescConstant
desc
)
}
instance
Show
ConstantDesc
where
{
show
desc
=
descToCode
""
(
DescConstant
desc
)
}
instance
Show
EnumDesc
where
{
show
desc
=
descToCode
""
(
DescEnum
desc
)
}
instance
Show
EnumDesc
where
{
show
desc
=
descToCode
""
(
DescEnum
desc
)
}
instance
Show
EnumValueDesc
where
{
show
desc
=
descToCode
""
(
DescEnumValue
desc
)
}
instance
Show
EnumValueDesc
where
{
show
desc
=
descToCode
""
(
DescEnumValue
desc
)
}
instance
Show
ClassDesc
where
{
show
desc
=
descToCode
""
(
DescClass
desc
)
}
instance
Show
StructDesc
where
{
show
desc
=
descToCode
""
(
DescStruct
desc
)
}
instance
Show
FieldDesc
where
{
show
desc
=
descToCode
""
(
DescField
desc
)
}
instance
Show
FieldDesc
where
{
show
desc
=
descToCode
""
(
DescField
desc
)
}
instance
Show
InterfaceDesc
where
{
show
desc
=
descToCode
""
(
DescInterface
desc
)
}
instance
Show
InterfaceDesc
where
{
show
desc
=
descToCode
""
(
DescInterface
desc
)
}
instance
Show
MethodDesc
where
{
show
desc
=
descToCode
""
(
DescMethod
desc
)
}
instance
Show
MethodDesc
where
{
show
desc
=
descToCode
""
(
DescMethod
desc
)
}
compiler/src/Token.hs
View file @
2e3f671c
...
@@ -45,7 +45,7 @@ data Token = Identifier String
...
@@ -45,7 +45,7 @@ data Token = Identifier String
|
UsingKeyword
|
UsingKeyword
|
ConstKeyword
|
ConstKeyword
|
EnumKeyword
|
EnumKeyword
|
Class
Keyword
|
Struct
Keyword
|
InterfaceKeyword
|
InterfaceKeyword
|
OptionKeyword
|
OptionKeyword
deriving
(
Show
,
Eq
)
deriving
(
Show
,
Eq
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment