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

  • SEARCH
  • Home
  • 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 8881321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:19:25+00:00 2026-06-14T20:19:25+00:00

I’m very interested in Syntax Definitions for Sblime text 2 I’ve studied the basics

  • 0

I’m very interested in Syntax Definitions for Sblime text 2

I’ve studied the basics but I don’t know how to write RE (and rules) for smth like
variable = sentense, i.e. myvar = func(foo, bar) + baz

I can’t write anything better than ^\s*([^=\n]+)=([^=\n]+\n) (that doesn’t work)
How to write this RE in proper way?

Also, i have some difficulties in defining RE for block

IF i FROM .. TO ..
    ...
ELSE
    ...
END IF

Hoe to write it?

  • 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-06-14T20:19:26+00:00Added an answer on June 14, 2026 at 8:19 pm

    In this case you have to write a parser. A regex won’t work because the patterns may vary. You’ve already noticed it when you stated ‘variable = sentence’.
    For this, you can use spoofax or javacup for grammar definitions. I’ll give you a snip in JavaCup:

    Scanner issues: suppose ‘variable’ follows the pattern: (_|[a-zA-Z])(_|[a-zA-Z])*
    and ‘number’ is: ([0-9])+
    Note that number could be any decimal or int, but here I state it as that pattern, supposing my language only deals with integer (or whatever that pattern means 🙂 ).

    Now we can declare our grammar following the JavaCUP syntax. Which is more or less like:

    expression ::= variable “=” sentence

    sentence ::= sentence “+” sentence;
    sentence ::= sentence “-” sentence;
    sentence ::= sentence “*” sentence;
    sentence ::= sentence “/” sentence;

    sentence ::= number;

    …and that goes further.

    If you’ve never had any compiler’s class, it may seems very difficult to see. Plus there is a lot of grammar’s restrictions to avoiding infinity loop in the parser, depending on which you’re using (RL or LL).

    Anyway, the real answer for your question is: you can’t do what you want only with regex, i’ll need more concepts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I know there's a lot of other questions out there that deal with this

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.