Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
bd30f7ee
Commit
bd30f7ee
authored
Jan 15, 2016
by
Guy Nicholas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved fileParent into importFile per feedback
parent
523f2f3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
src/source/parser.scala
src/source/parser.scala
+12
-8
No files found.
src/source/parser.scala
View file @
bd30f7ee
...
...
@@ -33,20 +33,24 @@ case class Parser() {
val
visitedFiles
=
mutable
.
Set
[
File
]()
val
fileStack
=
mutable
.
Stack
[
File
]()
def
fileParent
:
String
=
if
(
fileStack
.
top
.
getParent
()
!=
null
)
return
fileStack
.
top
.
getParent
()
+
"/"
else
return
""
private
object
IdlParser
extends
RegexParsers
{
override
protected
val
whiteSpace
=
"""[ \t\n\r]+"""
.
r
def
idlFile
(
origin
:
String
)
:
Parser
[
IdlFile
]
=
rep
(
importFile
)
~
rep
(
typeDecl
(
origin
))
^^
{
case
imp
~
types
=>
IdlFile
(
imp
,
types
)
}
def
importFile
:
Parser
[
FileRef
]
=
(
"@"
~>
directive
)
~
(
"\""
~>
filePath
<~
"\""
)
^^
{
case
"import"
~
x
=>
val
newPath
=
fileParent
+
x
new
IdlFileRef
(
new
File
(
newPath
))
case
"extern"
~
x
=>
val
newPath
=
fileParent
+
x
new
ExternFileRef
(
new
File
(
newPath
))
def
importFile
:
Parser
[
FileRef
]
=
{
def
fileParent
:
String
=
if
(
fileStack
.
top
.
getParent
()
!=
null
)
return
fileStack
.
top
.
getParent
()
+
"/"
else
return
""
(
"@"
~>
directive
)
~
(
"\""
~>
filePath
<~
"\""
)
^^
{
case
"import"
~
x
=>
val
newPath
=
fileParent
+
x
new
IdlFileRef
(
new
File
(
newPath
))
case
"extern"
~
x
=>
val
newPath
=
fileParent
+
x
new
ExternFileRef
(
new
File
(
newPath
))
}
}
def
filePath
=
"[^\"]*"
.
r
...
...
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