Git Product home page Git Product logo

juliaparser.jl's People

Contributors

ararslan avatar davidanthoff avatar habemus-papadum avatar ismael-vc avatar jakebolewski avatar jeffbezanson avatar josephnunn avatar jrevels avatar keno avatar kristofferc avatar scottpjones avatar timholy avatar tkelman avatar waldyrious avatar yuyichao avatar zacln avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

juliaparser.jl's Issues

Round-trippable representation of source code

This might serve as a discussion place for a fully round-trippable representation of julia source code. Such a representation could potentially be useful for IDEs, source code formatting tools etc. My suggestions below are heavily inspired by the C# Roslyn design.

The first step would be to change the lexer to not ever skip any content, but return a stream of everything present in the file. Here is one possible design: 1) let the lexer return elements of a new type SyntaxToken that would essentially replace the current Token typealias and 2) represent all whitespaces, comments, new lines etc as SyntaxTrivia elements that are children of a SyntaxToken.

The next_token function would then return elements of type SyntaxToken. The stream of elements this method would return would be exactly the same as is currently, so I believe the existing downstream parser implementation would not have to change much, other than being able to deal with SyntaxToken instead of the current Union Token return type. The type might look like this:

immutable SyntaxToken
  # This should probably be a fixed size array/tuple or something
  LeadingTrivia::Array{SyntaxTrivia,1} 
  TrailingTrivia::Array{SyntaxTrivia,1}

  # Or maybe an enum? This could be values like :IdentifierToken, 
  # :FunctionKeyword, :StringLiteral etc.
  Kind::Symbol

  # This could potentially hold exactly the same thing that is currently returned by
  # next token
  Value

  # The type SyntaxSpan would just have two fields Start and End (or Length) and
  # would be the character range in the source file that is covered by this token
  Span::SyntaxSpan
end

The type SyntaxTrivia would hold things like whitespaces, comments, line endings etc.:

immutable SyntaxTrivia
  # Might be :EndOfLine, :Whitespace, :SingleLineComment
  Kind::Symbol

  # This could be left empty for Kind of :EndOfLine or :Whitespace, but
  # might contain e.g. the actual text of a comment.
  Value

  # Parent
  Token::SyntaxToken

  Span::SyntaxSpan
end

The tricky thing would be that the next_token method would need to allocate all the syntax trivia to a SyntaxToken. I think in Roslyn they have some simple rules, that all syntax trivia is owned by the preceding SyntaxToken, with some exceptions: the first SyntaxToken owns all preceeding trivia, all trivia after a line break is owned by the next SyntaxToken and the last SyntaxToken owns all remaining trivia, even stuff after a line break.

But I think that from a downstream point of view, that the current parser should just be able to consume such a new token stream and ignore the trivia easily.

So this is on the lexer side. I think from there on it would make most sense to have a parallel type to the existing Expr type for now. In Roslyn they have a type hierarchy of an abstract class SyntaxNode, and then concrete types for different types of syntax. Not sure whether that is better than the route that Expr took with a single type. But the key thing is that each SyntaxNode then has a vector of all the SyntaxNodes that constitute it, so they retain that data.

I generally have studied the SyntaxNode system in Roslyn less than the lexer part, but that seems the broad design. The key feature is that one can take a parsed tree of SyntaxNodes, and because all the syntax trivia is also preserved, write it out to a file again and have a full fidelity round trip thing. Implementing something like a syntax formatter on top of this would obviously be much easier than the current situation.

In terms of larger architecture, I guess my proposal would be to modify the current lexer in JuliaParser so that it returns SyntaxTokens, modify the current parser so that it operates based on SyntaxTokens, and then potentially introduce a second parser (or an option to the existing one) to produce a tree of SyntaxNode, in addition to the ability to produce a tree of Expr objects.

I guess one key question is whether such a feature set would actually help people who are trying to implement things like IDE support... The Roslyn project powers all of Visual Studio's language support, which is massive, from syntax highlighting, to tool tips, refactoring, source formatting etc.

Oh, and sorry for not just submitting a PR for this kind of thing. But I'm a bit out of my depth when it comes to lexers/parsers... The Roslyn design just looked really good to me, so I thought I should propose something like that here and see whether it might stimulate a useful discussion and maybe the interest of someone else to implement it.

De-unicodify internal API

This package isn't doing math, so isn't appropriate. The meaning on ¬ is pretty unconventional too, and ⨳, ⪥, ⤄ are tough to read. Would have been nice to open kf/loctrack as a PR for feedback before merging it into master.

diag should also be spelled out, otherwise it's not the same verb as the diagonal meaning used for that function in Base.

Using JuliaParser as primary parser does not seem to override the include statement

I created a file test.jl with the content in JuliaLang/julia#16163. When including this file, it seems the normal julia parser is running. However, when I paste the code manually I get the JuliaParser error messages. It seems that the include function is not being correctly overloaded?

There are also some trailing new lines in the error message from JuliaParser.

~ julia -L ~/.julia/v0.5/JuliaParser/bin/repl.jl

julia> a = include("/home/kristoffer/Documents/test.jl")
ERROR: LoadError: syntax: missing comma or ) in argument list
 in include_from_node1(::String) at ./loading.jl:426
 in eval(::Module, ::Any) at ./boot.jl:230
while loading /home/kristoffer/Documents/test.jl, in expression starting on line 1

julia> function g(a,b,c)
           f(a,b)
           f(a,b)
           f(a,(b,))
           f(a,(b,))
           f(a,(b,))
           f(a,(b,) # :(
           f(a,(b,))
           f(a,(b,))
           f(a,(b,))
       end
REPL:8:5 error: Expected ')' or ','
    f(a,(b,))
    ^
REPL:7:6 note: to match '(' here
    f(a,(b,) # :(
     ^


julia>

Tag new version

Could a new version be tagged? The atom-julia-client installation instructions right now tell people to checkout JuliaParser, if a new release was tagged that step could probably be eliminated, right? Given that the Atom stuff was mentioned recently on the mailing list, it would be nice to have an easy setup experience.

@one-more-minute

Keeping track of line numbers

In JuliaCI/Coverage.jl#36, I'm trying to leverage this to improve our accounting for code coverage. The biggest challenge is keeping track of line numbers appropriately. Here's a good example of the challenge (save this to a file /tmp/testparser.jl):

f1(x) = 2x
if isdefined(:f1)
    f2(x) = 3x
end
f3(x) = 4x

Here's what comes from parsing this file:

julia> io = open("/tmp/testparser.jl")
IOStream(<file /tmp/testparser.jl>)

julia> ast = Parser.parse(io)
:(f1(x) = begin  # none, line 1:   # we're at line 1
            2x
        end)

julia> ast = Parser.parse(io)
:(if isdefined(:f1) # line 2:
        f2(x) = begin  # none, line 2:   # we're at line 2+1 = 3
                3x
            end
    end)

julia> ast = Parser.parse(io)
:(f3(x) = begin  # none, line 1:    # we're at line 1+3 = 4?
            4x
        end)

Because the end doesn't get its own line number, it doesn't seem possible to keep track of the line number just by looking for :line exprs or LineNumberNodes.

Stopping the parser prematurely

It's enormously useful to parse and analyse code as it is written in order to provide things like context-sensitive autocompletion. The problem is that the code is usually unfinished, so the Julia parser will simply throw an error and return no useful information about the code itself.

So, it'd be great if JuliaParser.jl could have a mode where you tell it to parse up to a certain point in the code and return the current AST as if all the end statements and closing brackets had been given correctly. For example, given

function foo(x, y)
  return fft(

it would return

:(function foo(x, y)
    return fft()
  end)

Error when parsing type declaration in 0.4.0

julia> ts = Lexer.TokenStream("""
       type Foo
           name::AbstractString
       end
       """)
JuliaParser.Lexer.TokenStream(IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=38, maxsize=Inf, ptr=1, mark=-1),1,nothing,nothing,false,false,"")

julia> Lexer.next_token(ts)
:type

julia> Lexer.next_token(ts)
:Foo

julia> Lexer.next_token(ts)
'\n'

julia> Lexer.next_token(ts)
:name

julia> Lexer.next_token(ts)
ERROR: cannot resize array with shared data
 in push! at ./array.jl:433
 in read_operator at /Users/tim/.julia/v0.4/JuliaParser/src/lexer.jl:368
 in next_token at /Users/tim/.julia/v0.4/JuliaParser/src/lexer.jl:752
 in next_token at /Users/tim/.julia/v0.4/JuliaParser/src/lexer.jl:768

Pkg.update - julia is fixed at 0.4.3 conflicting with requirement for JuliaParser: [0.5.0-,∞)

Hi,

When I do a Pkg.update(), I am getting the following error. Is there a workaround for this issue?

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating JuliaParser...
INFO: Computing changes...
WARNING: julia is fixed at 0.4.3 conflicting with requirement for JuliaParser: [0.5.0-,∞)
ERROR: AbstractTrees can't be installed because it has no versions that support 0.4.3 of julia. You may need to update METADATA by running `Pkg.update()`
 in error at error.jl:22
 in resolve at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
 in update at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib
 in anonymous at pkg/dir.jl:31
 in cd at file.jl:22
 in cd at pkg/dir.jl:31
 in update at /Applications/Julia-0.4.3.app/Contents/Resources/julia/lib/julia/sys.dylib

Need to tag a new release

The current tagged version breaks Gallium in METADATA. Master works fine.

julia> using JuliaParser
INFO: Recompiling stale cache file /Users/viral/.julia/lib/v0.5/Compat.ji for module Compat.
INFO: Recompiling stale cache file /Users/viral/.julia/lib/v0.5/AbstractTrees.ji for module AbstractTrees.
ERROR: LoadError: LoadError: syntax: invalid operator ".!"
 in include_from_node1(::String) at ./loading.jl:426 (repeats 2 times)
 in eval(::Module, ::Any) at ./boot.jl:234
 in require(::Symbol) at ./loading.jl:357
while loading /Users/viral/.julia/v0.5/JuliaParser/src/lexer.jl, in expression starting on line 46
while loading /Users/viral/.julia/v0.5/JuliaParser/src/JuliaParser.jl, in expression starting on line 9

The directions for enabling the fancy parsing mode don't seem to work.

This is probably my fault, but I tried the following:

JuliaParser/bin [master] » julia -q -L repl.jl
julia> for i = 1:
ERROR: syntax: missing last argument in "1:" range expression
 in eval(::Module, ::Any) at ./boot.jl:237

This seems to be using the error messages from the original flisp parser.

Comments

I'm not even sure that this would make sense to do, but would it be possible to optionally keep comments in a parsed expression? I'm thinking a comment could be stored in a new type, for example a CommentNode, sort of like a LineNumberNode. Since an Expr with a CommentNode in it's :args field would not really be a valid expression, I suppose it would also require an ExprWithComments type or something.

The use case I'm thinking about is an automatic code formatting tool so it would be necessary to keep comments along with the code.

REPL: jl_uv_writecb() broken pipe EPIPE

This happens on Windows 10 64 bits, with versions 0.5.0-rc0+76 and 0.6.0-dev.62 when trying to run bin/repl.jl:

C:\Users\Ismael>C:\Julia-0.6\bin\julia.exe C:\Users\Ismael\.julia\v0.6\JuliaParser\bin\repl.jl
jl_uv_writecb() ERROR: broken pipe EPIPE

jl_uv_writecb() ERROR: broken pipe EPIPE

C:\Users\Ismael>

I had this version:

julia> Pkg.status("JuliaParser")
 - JuliaParser                   0.7.4

After that I tried to checkout the package, on v5.0 I get the same error as above, but now even more surprising is that after checking out on 0.6 now Windows doesn't even let me execute the command, even if I use Administrator privileges, I tried freeing the package again to v0.7.4 but it seems Windows has locked it up somehow and won't let me run it anymore, I would appreciate if someone could try to reproduce this bug.

Here are some screenshots:

damn

Error says: This application cannot be executed on this computer

damn2

Error says access denied

I think Microsoft just banned me from doing that WTF!? 😠 It's the first time I ever face this pop up on Windows with any program.

syntax: invalid operator ".!"

Version 0.5.0-rc0+0 (2016-07-26 20:22 UTC)
x86_64-w64-mingw32

julia> using JuliaParser
ERROR: LoadError: LoadError: syntax: invalid operator ".!"
in include_from_node1(::String) at .\loading.jl:426 (repeats 2 times)
in eval(::Module, ::Any) at .\boot.jl:234
in require(::Symbol) at .\loading.jl:357
while loading C:\Users\necka.julia\v0.5\JuliaParser\src\lexer.jl, in expression starting on line 46
while loading C:\Users\necka.julia\v0.5\JuliaParser\src\JuliaParser.jl, in expression starting on line 9

Move to JuliaLang

The native Julia parser is needed by other projects like the IDE, so it would make sense to house it under JuliaLang so that others can help keep up with changes to the base language.

[PkgEval] JuliaParser may have a testing issue on Julia 0.4 (2014-09-25)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-09-24 the testing status was Tests pass.
  • On 2014-09-25 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("JuliaParser")' log
INFO: Installing FactCheck v0.1.2
INFO: Installing JuliaParser v0.5.2
INFO: Package database updated

>>> 'using JuliaParser' log
Julia Version 0.4.0-dev+765
Commit 5bc820e (2014-09-25 01:04 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

>>> test log

[1mtest skip to end of line 
[0m
[32m7 facts verified.[0m


[1mtest read operator 
[0m
[32m1260 facts verified.[0m


[1mtest string_to_number 
[0m
[32m160 facts verified.[0m


[1mtest is char hex 
[0m
[32m23 facts verified.[0m

... truncated ...



[1mTOTAL: 371[0m
[32mPassed: 370[0m
[31mFailed: 0[0m
[31mErrors: 1[0m
[31m    /home/idunning/julia04/test/staged.jl[0m

[1mParser total time: 7.21 secs[0m
[1mBase   total time: 7.59 secs[0m
[1mParser is ~5.00% faster than base[0m

INFO: Testing JuliaParser
=============================[ ERROR: JuliaParser ]=============================

failed process: Process(`/home/idunning/julia04/usr/bin/julia /home/idunning/pkgtest/.julia/v0.4/JuliaParser/test/runtests.jl`, ProcessExited(1)) [1]

================================================================================
INFO: No packages to install, update or remove
ERROR: JuliaParser had test errors
 in error at error.jl:21
 in test at pkg/entry.jl:719
 in anonymous at pkg/dir.jl:28
 in cd at ./file.jl:20
 in cd at pkg/dir.jl:28
 in test at pkg.jl:68
 in process_options at ./client.jl:213
 in _start at ./client.jl:354
 in _start_3B_3594 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so

>>> end of log

Tests fail on v0.5

The master branch fails on some categories:

test cell expressions
  Failure :: (line:272) :: fact was false
    Expression: Parser.parse(ex) |> norm_ast --> Base.parse(ex) |> norm_ast
      Expected: :(Any[i for i = 1:10])
      Occurred: :($(Expr(:typed_comprehension, :Any, :i, :(i = 1:10))))
Out of 9 total facts:
  Verified: 8
  Failed:   1
test cat expressions
  Failure :: (line:272) :: fact was false
    Expression: Parser.parse(ex) |> norm_ast --> Base.parse(ex) |> norm_ast
      Expected: :([i for i = 1:10])
      Occurred: :($(Expr(:comprehension, :i, :(i = 1:10))))
Out of 9 total facts:
  Verified: 8
  Failed:   1
interpolate var in cache block
  Failure :: (line:272) :: fact was false
    Expression: Parser.parse(src) |> norm_ast --> Base.parse(src) |> norm_ast
      Expected: :(try 
    catch $(Expr(:$, :x)) # none, line 3:
    end)
      Occurred: :(try 
    catch $(Expr(:$, :x))
    end)
Out of 1 total fact:
  Failed:   1

[PkgEval] JuliaParser may have a testing issue on Julia 0.3 (2014-08-01)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-07-30 the testing status was Tests pass.
  • On 2014-08-01 the testing status changed to Tests fail, but package loads.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

INFO: Cloning cache of JuliaParser from git://github.com/jakebolewski/JuliaParser.jl.git
INFO: Installing FactCheck v0.1.2
INFO: Installing JuliaParser v0.5.0
INFO: Package database updated
INFO: Package database updated

0.4 Compatibility

Right now JuliaParser.jl fails its tests on 0.4, it'd be great to see that change as it's one of the major sticking points for Juno on 0.4.

Specialize TokenStreamer on the IO type

I did some experiments with the parse Base benchmark and by specializing the TokenStreamer on the IO type by adding another type parameter I seem to go from 60% slower than Base parser -> 40 % slower. I have only tested this on my laptop in a VM so it would be cool if someone could reproduce.

The changes to the code needed are trivial (add another parameter to the type and fixup the constructors below).

Incorrect parsing of top-level function application under some circumstances

Hi Jake,

I have some code to parse:

s = "0\na(b)"
ts = Lexer.TokenStream(s)

The second expression, a(b), parses correctly as a substring:

julia> Parser.parse(s[2:end])
:(a(b))

but the second expression doesn't get parsed correctly when I try to do the whole thing as a token stream:

julia> Parser.parse(ts)
0

julia> Parser.parse(ts)
:a

julia> Parser.parse(ts)
:b

Thanks!

testshell does not seem to work?

Typing:

function foo(x::Int)
end

gives the following output

INFO: Recompiling stale cache file /Users/jacobbolewski/.julia/lib/v0.5/TerminalUI.ji for module TerminalUI.
parse > function foo(x::Int)
end
ERROR: JuliaParser.Diagnostics.Incomplete(:other,JuliaParser.Diagnostics.Diagnostic(JuliaParser.Diagnostics.Message[JuliaParser.Diagnostics.Message(:error,JuliaParser.Tokens.SourceRange(0xffffffff,0x0000ffff,0xff),"incomplete: premature end of input")]))
 in require_token(::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Bool) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/lexer.jl:919
 in require_token(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:39
 in parse_Nary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_eq, ::Set{Char}, ::Symbol, ::Set{Symbol}, ::Bool, ::Bool, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:281
 in parse_resword(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Tokens.Token, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:988
 in parse_call(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:677
 in parse_decl(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:547
 in parse_factorh(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_decl, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:570
 in parse_unary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:607
 in parse_with_chains(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_rational, ::Set{Symbol}, ::Symbol) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:197 (repeats 2 times)
 in parse_range(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:489
 in parse_comparison(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:443
 in parse_and at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:412 [inlined]
 in parse_RtoL(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_and, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:230
 in parse_or(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:403
 in parse_RtoL(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_or, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:230
 in parse_arrow(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:417
 in parse_cond(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:261
 in parse_Nary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_cond, ::Set{Char}, ::Symbol, ::Set{Any}, ::Bool, ::Bool, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:298
 in parse_eq at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:385 [inlined]
 in parse_docstring(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_eq) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2114
 in parse_Nary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.##1#2, ::Set{Char}, ::Symbol, ::Set{Char}, ::Bool, ::Bool, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:298
 in parse_stmts(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:353
 in #parse#24(::JuliaParser.Parser.#parse_stmts, ::Function, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2149
 in (::JuliaParser.Parser.#kw##parse)(::Array{Any,1}, ::JuliaParser.Parser.#parse, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at ./<missing>:0
 in parse(::String) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2154


parse > end
ERROR: JuliaParser.Diagnostics.Diagnostic(JuliaParser.Diagnostics.Message[JuliaParser.Diagnostics.Message(:error,JuliaParser.Tokens.SourceRange(0xffffffff,0x0000ffff,0xff),"unexpected \"end\"")])
 in parse_unary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:604
 in parse_with_chains(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_rational, ::Set{Symbol}, ::Symbol) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:197 (repeats 2 times)
 in parse_range(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:489
 in parse_comparison(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:443
 in parse_and at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:412 [inlined]
 in parse_RtoL(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_and, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:230
 in parse_or(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:403
 in parse_RtoL(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_or, ::Set{Symbol}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:230
 in parse_arrow(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:417
 in parse_cond(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:261
 in parse_Nary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_cond, ::Set{Char}, ::Symbol, ::Set{Any}, ::Bool, ::Bool, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:298
 in parse_eq at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:385 [inlined]
 in parse_docstring(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.#parse_eq) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2114
 in parse_Nary(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}, ::JuliaParser.Parser.##1#2, ::Set{Char}, ::Symbol, ::Set{Char}, ::Bool, ::Bool, ::Void) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:298
 in parse_stmts(::JuliaParser.Parser.ParseState, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:353
 in #parse#24(::JuliaParser.Parser.#parse_stmts, ::Function, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2149
 in (::JuliaParser.Parser.#kw##parse)(::Array{Any,1}, ::JuliaParser.Parser.#parse, ::JuliaParser.Lexer.TokenStream{JuliaParser.Tokens.Token,Base.AbstractIOBuffer{Array{UInt8,1}}}) at ./<missing>:0
 in parse(::String) at /Users/jacobbolewski/.julia/v0.5/JuliaParser/src/parser.jl:2154


parse >

0.4 failure (in defining parse function)

With 0.4, this is now giving:

ERROR: LoadError: error in method definition: function Base.parse must be explicitly imported to be extended
 in include at ./boot.jl:250
 in include_from_node1 at ./loading.jl:129
 in include at ./boot.jl:250
 in include_from_node1 at ./loading.jl:129
 in reload_path at ./loading.jl:153
 in _require at ./loading.jl:68
 in require at ./loading.jl:51
 in include at ./boot.jl:250
 in include_from_node1 at ./loading.jl:129
while loading /Users/stevenj/.julia/JuliaParser/src/parser.jl, in expression starting on line 1864
while loading /Users/stevenj/.julia/JuliaParser/src/JuliaParser.jl, in expression starting on line 6
while loading /Users/stevenj/.julia/JuliaParser/test/runtests.jl, in expression starting on line 1

Frankly, I don't understand the source of this issue. Isn't it valid to define a JuliaParser.parse function that shadows Base.parse without extending it? (After all, this error about importing before extending was added in 2012: JuliaLang/julia@289c6df.)

Presumably, something has recently changed about Base.parse that suddenly makes Julia interpret the JuliaParser.parse as an extension of the same function rather than as a declaration of a new function in the JuliaParser namespace? (The issue is not that JuliaParser/src/parser.jl does export parse, since I get the same error if I comment out that line.)

@JeffBezanson, @vtjnash?

Error JuliaParser with Julia 0.4.5 win7 x64

Hello,
I got this error message when I try to install "JuliaParser" this package.
It has troubled me for a whole day.
could you help me to have a look at it?
thanks
INFO: Cloning cache of JuliaParser from https://github.com/JuliaLang/JuliaParser.jl.git
ERROR: failed process: Process(git clone -q --mirror https://github.com/JuliaLang/JuliaParser.jl.git 'C:\Users\CHEN Xia ngtuo\.julia\v0.4\.cache\JuliaParser', ProcessExited(128)) [128]
in pipeline_error at process.jl:555
in sync_end at task.jl:413
[inlined code] from task.jl:422
in add at pkg/entry.jl:64
in add at pkg/entry.jl:73
in anonymous at pkg/dir.jl:31
in cd at file.jl:32
in cd at pkg/dir.jl:31
in add at pkg.jl:23

Tag a new release?

I notice you're hard at work on this package. Just FYI the currently-tagged version (dating from October) fails Coverage.jl's new tests with this error:

ERROR: `convert` has no method matching convert(::Type{Bool}, ::Char)
This may have arisen from a call to the constructor Bool(...), since type constructors fall back to convert methods in julia v0.4.
Closest candidates are:
  convert(::Type{T}, ::T)
  convert(::Type{Int8}, ::Char)
  convert(::Type{UInt8}, ::Char)
  ...

 in next_token at /home/tim/.julia/v0.4/JuliaParser/src/lexer.jl:709
 in peek_token at /home/tim/.julia/v0.4/JuliaParser/src/lexer.jl:781
 in parse_decl at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:490
 in parse_factorh at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:510
 in parse_unary at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:536
 in parse_rational at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:392
 in parse_with_chains at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:190
 in parse_term at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:389
 in parse_shift at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:386
 in parse_with_chains at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:190
 in parse_range at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:437
 in parse_pipes at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:377
 in parse_comparison at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:395
 in parse_ineq at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:374
 in parse_arrow at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:371
 in parse_and at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:368
 in parse_cond at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:253
 in parse_Nary at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:283
 in parse_comma at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:362
 in parse_eq at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:352
 in parse_Nary at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:283
 in parse_stmts at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:340
 in parse at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:1861
 in parse at /home/tim/.julia/v0.4/JuliaParser/src/parser.jl:1864
 in anonymous at /home/tim/.julia/v0.4/Coverage/src/Coverage.jl:49
 in open at ./iostream.jl:137
 in amend_coverage_from_src! at /home/tim/.julia/v0.4/Coverage/src/Coverage.jl:45
 in process_file at /home/tim/.julia/v0.4/Coverage/src/Coverage.jl:118
 in anonymous at /home/tim/.julia/v0.4/Coverage/test/runtests.jl:10
 in cd at ./file.jl:20
 in include at ./boot.jl:248
 in include_from_node1 at ./loading.jl:128
while loading /home/tim/.julia/v0.4/Coverage/test/runtests.jl, in expression starting on line 9

In contrast, the master branch passes beautifully.

Improve documentation.

This issue is for tracking progress in the documentation of this package. Currently there is almost no documentation, lots of short names and some very cryptic ones, I think that this will help improve, the overall project and help other people contribute with actual code to this repository.

  • document all top level constants and global identifiers, even if not exported.
    • Use ALL_CAPS for constants
  • document all functions
    • use docstrings
    • add signatures to docstrings with return types
    • explain all arguments
    • don't use short names specially when that argument could be of Any type.
    • brevity is fine in cases where the variable is typed ie, o::MyObject, d # stands for diagnostic, or long_var_name; lvn = long_var_name; # do something with lvn and is a one line function definition, for multi line function definition, longer names should be preferred.
  • add more examples.
    • this will help define the wanted API in order to use as library.
  • change short names to more descriptive ones or add a comment with a full name at first use.
  • require new code to be documented before being merged, so everything should be peer reviewed. (I know I'm not at the level to review you guys, but at least I can poke you if you add something not documented).
  • also add more comments, please believe me not everyone is an expert at implementing parsers and lexers, this code is so little, that I could even imagine using it to teach fresh students (myself included) how does this stuff work.

This is what I've thought so far, based on my experience, feel free to give more suggestions or corrections. Since I would gladly do this all myself, but since I'm not qualified to document this, I'll open a PR per file and ask for your input here.

The objetive is to reduce the overall entry barrier needed from newcomers to the code base in order for them to be able to actually contribute with actual code and hopefully get more traffic of interested developers.

typo

There's a typo here where the argument of reverse! should presumably be lst (PR #72) but in finding it I uncovered a bug.

parse("[1,2;3]")

results in ERROR: MethodError: no method matching merge(::Expr, ::Base.#next) rather than a JuliaParser generated error message.

parse("[1;2,3]") gives the expected error

Info about upcoming removal of packages in the General registry

As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.

To transition to the new Pkg system using Project.toml, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.

If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.

No way to use it?

import Pkg; Pkg.clone("https://github.com/JuliaLang/JuliaParser.jl")

ERROR: UndefVarError: clone not defined
Stacktrace:
[1] getproperty(::Module, ::Symbol) at ./Base.jl:26
[2] top-level scope at REPL[8]:1

import Pkg; Pkg.add(Pkg.PackageSpec(url="https://github.com/JuliaLang/JuliaParser.jl") )

Cloning git-repo `https://github.com/JuliaLang/JuliaParser.jl`

Updating git-repo https://github.com/JuliaLang/JuliaParser.jl
ERROR: could not find project file in package at https://github.com/JuliaLang/JuliaParser.jl
Stacktrace:
[1] pkgerror(::String) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:53
[2] resolve_projectfile!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec, ::String) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:629
[3] (::Pkg.Types.var"#54#55"{Pkg.Types.Context,Pkg.Types.PackageSpec})(::LibGit2.GitRepo) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:602
[4] with(::Pkg.Types.var"#54#55"{Pkg.Types.Context,Pkg.Types.PackageSpec}, ::LibGit2.GitRepo) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/LibGit2/src/types.jl:1125
[5] handle_repo_add!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:562
[6] handle_repos_add!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:620
[7] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.MacOS, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:139
[8] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:112
[9] #add#27 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:109 [inlined]
[10] add at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:109 [inlined]
[11] #add#23 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:106 [inlined]
[12] add(::Pkg.Types.PackageSpec) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:106
[13] top-level scope at REPL[7]:1

Add custom operators

Hi all,

I'm pretty new to Julia and mostly coded in C/C++, so I would like to implement some C-ish operators like -> to dereference pointers.

But since there is no -> operator, I cannot create/overload such. Is there any easy way to simply define new operators, which can then be freely used? I glimpsed a bit over the code, but couldn't even find the "operator handling code" yet, lol.

IMO that would make code much cleaner to read, e.g. from unsafe_load(someptr).somefield to someptr->somefield, especially when nested, like linkedlist->next->next->prev->next (imagine the unsafe_load version yourself :p). But this is not the only case, I would generally love to just add all kinds of custom operators.

Something like JuliaParse.AddCustomOperator("->"), maybe with settings like left/right binding powers (or whatever, I never wrote a full parser) for fine tuning. Would be epic if somebody has an idea how to accomplish this.

[PkgEval] JuliaParser may have a testing issue on Julia 0.4 (2014-09-29)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-09-28 the testing status was Tests fail, but package loads.
  • On 2014-09-29 the testing status changed to Package doesn't load.

Tests fail, but package loads. means that PackageEvaluator found the tests for your package, executed them, and they didn't pass. However, trying to load your package with using worked.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This error on Julia 0.4 is possibly due to recently merged pull request JuliaLang/julia#8420.
This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("JuliaParser")' log
INFO: Installing FactCheck v0.1.2
INFO: Installing JuliaParser v0.5.2
INFO: Package database updated

>>> 'using JuliaParser' log
Julia Version 0.4.0-dev+842
Commit e5d8c1a (2014-09-29 06:50 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

ERROR: InexactError()
 in char at char.jl:1
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_3625 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/JuliaParser/src/lexer.jl, in expression starting on line 12
while loading /home/idunning/pkgtest/.julia/v0.4/JuliaParser/src/JuliaParser.jl, in expression starting on line 5
while loading /home/idunning/pkgtest/.julia/v0.4/JuliaParser/testusing.jl, in expression starting on line 2

>>> test log
no tests to run
>>> end of log

Return type declarations are not parsed correctly

julia> import JuliaParser.Parser

julia> src = """
       function f(x)::Float64
           return x
       end
       """;

julia> parse(src)
:(function f(x)::Float64 # none, line 2:
        return x
    end)

julia> JuliaParser.Parser.parse(src)
:(function f(x) # none, line 1:
        ::Float64 # none, line 2:
        return x
    end)

julia> eval(JuliaParser.Parser.parse(src))
f (generic function with 1 method)

julia> f(1.0)
ERROR: ArgumentError: typeassert: too few arguments (expected 2)
 in f(::Float64) at ./none:1
 in eval(::Module, ::Any) at ./boot.jl:234
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

Add a Gitter channel badge.

I'd like to propose the creation of a Gitter chat room and the inclusion of a badge to this repository README, this would allow us to communicate more widely, meet each other, share ideas and get feedback in a more real time fashion and iterate faster among those ideas, ask questions specific to JuliaParser, etc. and that are not necessarily as technical or formal nor expected to be as ever lasting as issues and PRs must be and even goof around a while, why not?

Some examples, that in my experience have been very useful to boost Julia and also individual projects in the Julian community:

And many many more! 😄

I'm very glad to see lots of improvements on this repo, which I'm trying to use to implement a Julia multi-language parser, and hopefully some time I may even be able to propose a way to integrate it into Julia proper. As I learn and experiment I have lots of doubts about the code, which I would like to help document, but since precisely I don't know and understand all of the code, I would like to have a place where I can ask you guys questions that will help me reach 100% documentation of all the current code related to this project. Which would help us scratch the third bullet in the TODO list about modularization for library use.

I'm sure most of my doubts are not worthy of opening an issue, please tell me what you think, I even think it would be nice to have this on each and every one of the Julia repos. I know there are forums, and other venues, but I have to say I like chatting even more and so do others! 😉

In order to do this you need to log into gitter with a github account, select create room, select from repository, and select this repo, then select integrations and select Github, that triggers a PR from the gitter-badger bot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.