-
Notifications
You must be signed in to change notification settings - Fork 7
fixes #4 update grammar to the latest spec #5
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
Conversation
Are you sure the grammar is loaded properly? It seems to have support for comments... |
heh, I dont exactly remember how things work 😄 @marcellourbani what triggered the above output? highlight js has some language auto-detection, did it detect a different language? we need to setup some kind of automatic testing #3, some of the other repos in https://github.com/highlightjs probably got something we can borrow |
I'm pretty confident: if I change the keywords the highlighting changes. {
className: 'comment',
begin: '^[*]',
relevance: 0,
end: '\n'
} It does need fixing, just not sure the fix belongs to this PR The html rendered above looks like this: <html>
<head>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/default.min.css"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
<script
type="text/javascript"
charset="UTF-8"
src="../dist/abap.min.js"
></script>
<script type="text/javascript">
hljs.initHighlightingOnLoad()
</script>
</head>
<body>
<pre><code class="abap">
REPORT z_highlight_js.
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
* Purpose:
* ~~~~~~~~
* This reports illustrates how an ABAP program looks in Highlight.js
*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
DATA: gt_sflight TYPE sflight OCCURS 0, " Output-Table
gt_fieldcatalog TYPE lvc_t_fcat,
ok_code LIKE sy-ucomm,
save_ok LIKE sy-ucomm. " OK-Code
*###############################################################
* LOCAL CLASSES
*###############################################################
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* §4.Define a class for a data object to exchange data
* within ALV Control when using the drag and drop operation.
CLASS LCL_DRAGDROPOBJ DEFINITION.
PUBLIC SECTION.
DATA: cps_sflight TYPE sflight,
cp_node_text TYPE lvc_value,
cp_node_key TYPE lvc_nkey.
ENDCLASS.
START-OF-SELECTION.
WRITE 'END OF TEST'.
END-OF-SELECTION.
</code></pre>
</body>
</html> |
the new |
That's done by the main package, I will add a note about it. |
@joshgoebel |
Yeah, the
You're welcome to generate |
@larshp I added the build instructions in README
Which is way more complex than what I feel like doing for this |
@marcellourbani thanks, merging |
Yeah, it could be simpler, but after it's setup it's not much effort at all. Also, I've always started with the assumption that grammar authors are already building us - you need to in order to debug and test your grammar with the developer tools we provide (which are pretty helpful). Is that a faulty assumption? The easiest way to test and debug a grammar is to build your grammar INSIDE our library.
Once you had the structure setup once I'd think a bash script that simply |
@joshgoebel |
@larshp

This fits the bill of adjusting to the new format, but the output isn't great:
i.e. CLASS is not a keyword, comments are not dealt properly,...
To fix that I'll need to actually fix the grammar, possibly based on Marc's file above.
But I think it deserves its own PR