This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Where are combinator parser combinators defined?

13 replies
Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
I've looked at a reasonable amount of the combinator parsers code (particularly RegexParsers.scala and Parsers.scala), and simply haven't come across the definitions of the actual combinators: ~, ~>, |, etc. Where are these defined?
Thanks,Ken
Tony Sloane
Joined: 2009-01-07,
User offline. Last seen 2 years 32 weeks ago.
Re: Where are combinator parser combinators defined?

On 30/05/2011, at 2:27 PM, Ken McDonald wrote:

> I've looked at a reasonable amount of the combinator parsers code (particularly RegexParsers.scala and Parsers.scala), and simply haven't come across the definitions of the actual combinators: ~, ~>, |, etc. Where are these defined?

Parsers.scala. Search for "def ~".

cheers,
Tony

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Where are combinator parser combinators defined?

On Mon, May 30, 2011 at 01:39, Tony Sloane wrote:
> On 30/05/2011, at 2:27 PM, Ken McDonald wrote:
>
>> I've looked at a reasonable amount of the combinator parsers code (particularly RegexParsers.scala and Parsers.scala), and simply haven't come across the definitions of the actual combinators: ~, ~>, |, etc. Where are these defined?
>
> Parsers.scala.  Search for "def ~".

Actually, no. It is implemented in Parsers.Parser, so you have to look
up Parsers, then click on Parser, and _then_ you'll see it.

On the other hand, right under the search box for packages/classes,
there's a small index. Clicking on "#" will show a list of all methods
starting with a symbol, so you can just search for "~" in it, and see
all implementing classes.

Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Where are combinator parser combinators defined?
Yes, when I looked in Parsers.scala (the api) again and couldn't find it, I remembered someone had recently post a Scaladoc message to the effect that inner classes and traits were not getting documented properly. I found it by going into the source for Parsers.scala. After this, I'd have to agree that's a definite hole in Scaladoc...
Thanks,Ken
Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Where are combinator parser combinators defined?

On Monday May 30 2011, Ken McDonald wrote:
> Yes, when I looked in Parsers.scala (the api) again and couldn't find
> it, I remembered someone had recently post a Scaladoc message to the
> effect that inner classes and traits were not getting documented
> properly. I found it by going into the source for Parsers.scala.
> After this, I'd have to agree that's a definite hole in Scaladoc...
>
> Thanks,
> Ken

This sort of thing is exactly why an IDE is called for. If you were
using IDEA you'd just ALT-click or select and CTRL-B and you'd be
there.

Randall Schulz

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Where are combinator parser combinators defined?

On Mon, May 30, 2011 at 15:34, Ken McDonald wrote:
> Yes, when I looked in Parsers.scala (the api) again and couldn't find it, I
> remembered someone had recently post a Scaladoc message to the effect that
> inner classes and traits were not getting documented properly. I found it by
> going into the source for Parsers.scala. After this, I'd have to agree
> that's a definite hole in Scaladoc...

You don't need to go to the sources. Go to Parsers, and then find and
click on Parser, listed under Type Members.

Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Where are combinator parser combinators defined?
Hmm, guess I need to get my Scala source files properly configured under IDEA, I just taken to the class file, not so useful :-)
Ken
Tony Sloane
Joined: 2009-01-07,
User offline. Last seen 2 years 32 weeks ago.
Re: Where are combinator parser combinators defined?

On 30/05/2011, at 11:47 PM, Daniel Sobral wrote:

> On Mon, May 30, 2011 at 01:39, Tony Sloane wrote:
>> On 30/05/2011, at 2:27 PM, Ken McDonald wrote:
>>
>>> I've looked at a reasonable amount of the combinator parsers code (particularly RegexParsers.scala and Parsers.scala), and simply haven't come across the definitions of the actual combinators: ~, ~>, |, etc. Where are these defined?
>>
>> Parsers.scala. Search for "def ~".
>
> Actually, no. It is implemented in Parsers.Parser, so you have to look
> up Parsers, then click on Parser, and _then_ you'll see it.

Indeed. But Ken did say he was looking at the code, not the API docs...

cheers,
Tony

dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Where are combinator parser combinators defined?

On Mon, May 30, 2011 at 19:09, Tony Sloane wrote:
> On 30/05/2011, at 11:47 PM, Daniel Sobral wrote:
>
>> On Mon, May 30, 2011 at 01:39, Tony Sloane wrote:
>>> On 30/05/2011, at 2:27 PM, Ken McDonald wrote:
>>>
>>>> I've looked at a reasonable amount of the combinator parsers code (particularly RegexParsers.scala and Parsers.scala), and simply haven't come across the definitions of the actual combinators: ~, ~>, |, etc. Where are these defined?
>>>
>>> Parsers.scala.  Search for "def ~".
>>
>> Actually, no. It is implemented in Parsers.Parser, so you have to look
>> up Parsers, then click on Parser, and _then_ you'll see it.
>
> Indeed.  But Ken did say he was looking at the code, not the API docs...

Oh, sorry then. My mistake.

Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Where are combinator parser combinators defined?

This sort of thing is exactly why an IDE is called for. If you were
using IDEA you'd just ALT-click or select and CTRL-B and you'd be
there.


Randall Schulz


Doing so takes me to the class file, even though in my project settings I have the scala 2.9 source jar attached as a source file. (This is IDEA, I should mention.) I've never been able to figure out how to get this feature to work, please feel free to give me pointers.
Thanks,Ken
Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Where are combinator parser combinators defined?

On Tuesday May 31 2011, Ken McDonald wrote:
> > This sort of thing is exactly why an IDE is called for. If you were
> > using IDEA you'd just ALT-click or select and CTRL-B and you'd be
> > there.
> >
> >
> > Randall Schulz
>
> Doing so takes me to the class file, even though in my project
> settings I have the scala 2.9 source jar attached as a source file.
> (This is IDEA, I should mention.) I've never been able to figure out
> how to get this feature to work, please feel free to give me
> pointers.

You did attach it as the source for the Scala library, right?

It has always worked for me. The only challenge is when the project is
generated by the IDEA project-generating plug-in for SBT.

> Thanks,
> Ken

Randall Schulz

Ken McDonald
Joined: 2011-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Where are combinator parser combinators defined?

You did attach it as the source for the Scala library, right?

It has always worked for me. The only challenge is when the project is
generated by the IDEA project-generating plug-in for SBT.


Yes, .../scala-2.9.0/src/scala-library-src.jar is attached as a source file in the "buildScala" library of the project. It's also attached to my "Scala 2.9.0" Global library, but since I never set projects to use a Global library but always to the project-specific "buildScala", I can't imagine that's relevant one way or another.
However, I _do_ generate the project using the sbt IDEA plugin, so perhaps that's causing problems. But I can't figure out why IDEA can't find a source jar that is definitely, absolutely attached to the project, especially since it can find the jar containing the corresponding .class file.
Don't worry about it too much, it's not a biggie, but if you have any quick ideas, that'd be great.
Thanks,Ken  
Randall R Schulz
Joined: 2008-12-16,
User offline. Last seen 1 year 29 weeks ago.
Re: Where are combinator parser combinators defined?

On Wednesday June 1 2011, Ken McDonald wrote:
> > You did attach it as the source for the Scala library, right?
> >
> > It has always worked for me. The only challenge is when the project
> > is generated by the IDEA project-generating plug-in for SBT.
> >
> >
> > Yes, .../scala-2.9.0/src/scala-library-src.jar is attached as a
> > source file
>
> ...
>
> However, I _do_ generate the project using the sbt IDEA plugin, so
> perhaps that's causing problems. But I can't figure out why IDEA
> can't find a source jar that is definitely, absolutely attached to
> the project, especially since it can find the jar containing the
> corresponding .class file.
>
> ...
>
> Thanks,
> Ken

http://stackoverflow.com/questions/4477505/how-can-i-let-sbt-download-th...

Randall Schulz

Bill Atkins
Joined: 2011-05-10,
User offline. Last seen 42 years 45 weeks ago.
Re: Where are combinator parser combinators defined?

http://devnet.jetbrains.net/thread/304576

You're not alone.

On Jun 1, 4:49 pm, Ken McDonald wrote:
> However, I _do_ generate the project using the sbt IDEA plugin, so perhaps
> that's causing problems. But I can't figure out why IDEA can't find a source
> jar that is definitely, absolutely attached to the project, especially since
> it can find the jar containing the corresponding .class file.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland