Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Djinni Interface Inheritance #270

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fix IdlParser's importFile path resolution.
Converts the combination of the import file's parent path and the import string to a canonical File. The result of this is that a Djinni file can be imported by multiple Djinni files that are located in different subdirectories.
  • Loading branch information
Mike Foster committed Mar 7, 2016
commit 3b88bc0cabedd3b967545f47302bc8cd4ad1d69c
6 changes: 4 additions & 2 deletions src/source/parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ private object IdlParser extends RegexParsers {

def importFile: Parser[FileRef] = {

def fileParent:String = if (fileStack.top.getParent() != null) return fileStack.top.getParent() + "/" else return ""
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))

def importFile = new File(newPath)
new IdlFileRef(importFile.getCanonicalFile)
case "extern" ~ x =>
val newPath = fileParent + x
new ExternFileRef(new File(newPath))
Expand Down