编译时需要文件的EOF错误

时间:2018-03-01 07:20:32

标签: crystal-lang

所以我目前有目前的目录结构:

- project
  - lib
    - struct
      - external
        - external.cr
  - src
    - project
      - version.cr
    - project.cr
  - ...
  - shard.yml

我正在使用当前命令编译我的代码,而在主项目目录(包含shard.yml)中:

`crystal src/project.cr`

I then receive the following error:

Error in src/project.cr:2: while requiring "struct/external"

require "struct/external"
^

Syntax error in lib/struct/external/external.cr:15: expecting identifier 'end', not 'EOF'

我的project.cr文件如下所示:

require "./project/*"
require "struct/external"

# Doc omitted 
module Project
    extend self
end

我的external.cr文件如下所示:

#
class External
    def initialize(@vertices : Array(SubclassOne), @edges : Array(SubclassTwo))
end

#
class SubclassOne
    def initialize()
end

#
class SubclassTwo
    def initialize()
end

1 个答案:

答案 0 :(得分:0)

外部文件中的类中的函数缺少end关键字。