Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple languages #6

Closed
txus opened this issue Nov 9, 2011 · 11 comments
Closed

Support multiple languages #6

txus opened this issue Nov 9, 2011 · 11 comments
Labels

Comments

@txus
Copy link
Member

txus commented Nov 9, 2011

No description provided.

@mrcasals
Copy link

mrcasals commented Apr 7, 2012

Any idea on how to start working on this?

@mrcasals
Copy link

mrcasals commented Apr 7, 2012

I need this, I'll start working on it and ask form help if I get stuck... But it looks like I should start from here, right?

https://github.com/codegram/gherkin-ruby/blob/master/lib/gherkin/parser/lexer.rb#L61-104

@txus
Copy link
Member Author

txus commented Apr 7, 2012

We need to hook into the lexer (defined here, the file you mentioned is autogenerated from this one) to identify the header like:

# language: ca
Feature: Fer alguna cosa

And then use the corresponding set of tokens. The lexer is written in Rexical, so we just need to figure out how to execute some code before, dynamically set which set of tokens are we using, and then let the lexer tokenize the file, and then we're done. Makes sense?

@txus
Copy link
Member Author

txus commented Apr 7, 2012

Actually it's very easy, look at this part of the code. Here, before the call to scan_setup(code), we should define an instance variable with a hash or something like this:

locale = code.scan(/language/ bla bla whatever
@tokens = get_tokens_from_locale(locale) # => this would return something like { :When => "Quan", :Then => "Llavors" ... }
scan_setup(code)

And then I don't know how to use these tokens in the lexer. But it's something. What do you think?

@mrcasals
Copy link

mrcasals commented Apr 7, 2012

Looks nice to me, but I don't see myself succeeding on this alone...

Marc Riera Casals

On Saturday, April 7, 2012 at 4:02 PM, Josep M. Bach wrote:

Actually it's very easy, look at this part of the code. Here, before the call to scan_setup(code), we should define an instance variable with a hash or something like this:

locale = code.scan(/language/ bla bla whatever
@tokens = get_tokens_from_locale(locale) # => this would return something like { :When => "Quan", :Then => "Llavors" ... }
scan_setup(code)

And then I don't know how to use these tokens in the lexer. But it's something. What do you think?


Reply to this email directly or view it on GitHub:
#6 (comment)

@txus
Copy link
Member Author

txus commented Sep 14, 2012

Just a small status update, anyone up for implementing this? @mrcasals @Dor3nz @divins @oriolgual @josepjaume ?

@oriolgual
Copy link
Member

We haven't actually needed this, so.... :P

@mrcasals
Copy link

I do have needed this, but I don't know how to fixnit :(
On Sep 14, 2012 7:13 PM, "Oriol Gual" notifications@github.com wrote:

We haven't actually needed this, so.... :P


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-8568472.

@jmgarnier
Copy link

Sorry, I will not contribute because I'm working on my own vegetable: a Gherkin DSL on top of RSpec: https://github.com/21croissants/maniok_bdd/

@oriolgual
Copy link
Member

OK, nevermind.

@RunsFor
Copy link

RunsFor commented Jun 26, 2014

Hi,

I'm wondering if this feature are planned to be implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants