Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6968703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:29:12+00:00 2026-05-27T16:29:12+00:00

I have defined an EnumRule like following in my Xtext grammar file: enum MySpec_directionEnum:

  • 0

I have defined an EnumRule like following in my Xtext grammar file:


enum MySpec_directionEnum:
left='"left"' | right='"right"' | none='"none"';

With this rule the allowed enum values are "left", "right" and "none" (all in lower case). I want to be able to allow these values in any case(case insensitive). For example I want to also allow the values to be "left" or "Left" or "LEFT" or "LeFt" and so on.

But I just want values of MySpec_directionEnum enum to be case insensitive and not all enums in my grammar file. Is it possible through grammar or some kind of validation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:29:13+00:00Added an answer on May 27, 2026 at 4:29 pm

    I think your best option is to replace the enum rule with an ordinary parser rule, like

    MySpec_directionEnum:
        value=STRING;
    

    and check if value is a permitted string (case-insensitive variant of “left”, “right” or “none”) in the validator:

    @Check
    public void check(MySpec_directionEnum e) {
        String lowercaseValue = e.getValue().toLowerCase();
        if (!lowercaseValue.equals("left")) {
            error("Expected \"left\".", e, 
                ArithmeticsPackage.Literals.MY_SPEC_DIRECTION_ENUM__VALUE,
                validationMessageAcceptor.INSIGNIFICANT_INDEX);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have defined an AIDL file with my interface. Something like this: interface IResPlugin
I have defined the following variable: myVar=true now I'd like to run something along
/*I have defined Extension Methods for the TypeX like this*/ public static Int32 GetValueAsInt(this
I have defined a generic tree-node class like this: template<class DataType> class GenericNode {
I have defined a .dir-locals.el file with the following content: ((python-mode . ((cr/virtualenv-name .
I have defined an Action pure abstract class like this: class Action { public:
I have defined a class to process a file but get the following error
I have defined some models like this (Entity Framework Code-First): public class A {
I have defined an assembly level attribute class FooAttribute like this: namespace Bar {
I have defined @property(nonatomic,retain)NSString *usrId; then assigned a value like this: usrId=[Screen.Info valueForKey:@id]; Then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.