Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Citrus require
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ken  
View profile  
 More options Dec 29 2011, 12:56 am
From: Ken <kenp...@gmail.com>
Date: Wed, 28 Dec 2011 21:56:56 -0800 (PST)
Local: Thurs, Dec 29 2011 12:56 am
Subject: Citrus require
Hi,

In the following example copied from
https://github.com/mjijackson/citrus/blob/master/lib/citrus/grammars/...

require 'ipv4address'                 # (1)
require 'ipv6address'

grammar IPAddress
  include IPv4Address
  include IPv6Address

  rule IPaddress
    IPv4address | IPv6address
  end
end

Is the line (1) should be written like

   Citrus.require 'ipv4address'

Do I miss anything?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Jackson  
View profile  
 More options Dec 29 2011, 1:26 am
From: Michael Jackson <mjijack...@gmail.com>
Date: Wed, 28 Dec 2011 22:26:35 -0800
Local: Thurs, Dec 29 2011 1:26 am
Subject: Re: Citrus require

Hi Ken,

The thing you need to remember is that although .citrus files look like
Ruby, they're not really Ruby. They're actually a custom little language
that looks a lot like Ruby. You can see the implementation for a `require`
statement inside a .citrus file here:

https://github.com/mjijackson/citrus/blob/master/lib/citrus/file.rb#L...

It simply tries to use Kernel.require first, and falls back to
Citrus.require if that fails. If both fail, the original LoadError is
raised.

--
Michael Jackson
@mjackson


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken  
View profile  
 More options Dec 29 2011, 2:54 am
From: Ken <kenp...@gmail.com>
Date: Wed, 28 Dec 2011 23:54:33 -0800 (PST)
Local: Thurs, Dec 29 2011 2:54 am
Subject: Re: Citrus require
Thanks for the explanation.

     # File lib/citrus.rb, line 99
 99:   def self.require(file, options={})
100:     file += '.citrus' unless /\.citrus$/ === file
101:     found = nil
102:
103:     paths = ['']
104:     paths += $LOAD_PATH unless Pathname.new(file).absolute?

If you look at line 103, it seems the paths is initialized with an
empty value,
then the "require" will run a unnecessary loop actually because paths
will be
the "" + the current $LOAD_PATH, I think this may be corrected like
below,

  paths = []

or just remove the line 103, as $LOAD_PATH is an Array, so we can just
change 104 to,

  paths = $LOAD_PATH unless Pathname.new(file).absolute?

The initialization of a new array to paths seems to be not needed.

On Dec 29, 2:26 pm, Michael Jackson <mjijack...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken  
View profile  
 More options Dec 29 2011, 2:57 am
From: Ken <kenp...@gmail.com>
Date: Wed, 28 Dec 2011 23:57:34 -0800 (PST)
Local: Thurs, Dec 29 2011 2:57 am
Subject: Re: Citrus require

On Dec 29, Ken wrote:

> The initialization of a new array to paths seems to be not needed.

Oops, it is needed by 105:     paths.each do |path|.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »