Pygments

generic syntax highlighter


Ticket #394 (closed enhancement: fixed)

Opened 12 months ago

Last modified 11 months ago

new ABAP lexer

Reported by: adsworth Owned by: gbrandl
Priority: major Milestone:
Component: docs Keywords: ABAP lexer
Cc: adi@…

Description

a lexer for the ABAP programming language.

Attachments

abap-lexer.diff (10.2 kB) - added by adsworth 12 months ago.
abap-lexer-version2.diff (10.1 kB) - added by adsworth 12 months ago.
abap-lexer-version3.diff (10.1 kB) - added by adsworth 12 months ago.
abap-lexer-version4.diff (10.7 kB) - added by adsworth 11 months ago.

Change History

Changed 12 months ago by adsworth

  Changed 12 months ago by adsworth

  • priority changed from blocker to major

  Changed 12 months ago by adsworth

  • cc adi@… added

  Changed 12 months ago by adsworth

There is one little problem with the current implementation. ABAP allows keywords as variable names.

The following is perfectly legal ABAP:

DATA data TYPE sflight.

SELECT * FROM sflight INTO data WHERE carrid = 'BAR'. 

The current version of the lexer would highlight all ocurrences of data as a keyword. It should only highlight the first occurence as keyword and the other occurences as Name.Variable. I would need to implement a state for nearly all ABAP statements and I currently haven't gone through the trouble.

Maybe I'll get to it bit by bit.

follow-up: ↓ 5   Changed 12 months ago by gbrandl

  • owner changed from adsworth to gbrandl
  • status changed from new to accepted

Maybe it isn't worth the trouble. (Please don't tell me it is standard practice to use keywords as identifiers...)

Changed 12 months ago by adsworth

in reply to: ↑ 4   Changed 12 months ago by adsworth

Replying to gbrandl:

Maybe it isn't worth the trouble. (Please don't tell me it is standard practice to use keywords as identifiers...)

No, it's not standard pratice to use keywords. Though I have seen some SAP demo programs that do. I attached a new patch that fixes some issues.

Changed 12 months ago by adsworth

  Changed 12 months ago by adsworth

and I though I had it. One more fix.

follow-up: ↓ 8   Changed 12 months ago by gbrandl

Could you please rewrap it to EOL80?

Changed 11 months ago by adsworth

in reply to: ↑ 7   Changed 11 months ago by adsworth

Replying to gbrandl:

Could you please rewrap it to EOL80?

rewrapped and cleaned it up some.

follow-up: ↓ 10   Changed 11 months ago by gbrandl

  • status changed from accepted to closed
  • resolution set to fixed

Committed in [1e77cfc028a1]. Do you have an example file for the test suite?

in reply to: ↑ 9   Changed 11 months ago by adsworth

Replying to gbrandl:

Committed in [1e77cfc028a1]. Do you have an example file for the test suite?

I currently only have an example file which uses demos created by SAP. I'm not sure about making them public. I'll either get some public samples or put something together myself.

Note: See TracTickets for help on using tickets.