[frameworks-syntax-highlighting] [Bug 468394] New: r.xml syntax highlighting definitions miss specified integers (e.g., 3L)
npearlmu
bugzilla_noreply at kde.org
Tue Apr 11 17:32:08 BST 2023
https://bugs.kde.org/show_bug.cgi?id=468394
Bug ID: 468394
Summary: r.xml syntax highlighting definitions miss specified
integers (e.g., 3L)
Classification: Frameworks and Libraries
Product: frameworks-syntax-highlighting
Version: unspecified
Platform: unspecified
OS: macOS
Status: REPORTED
Severity: minor
Priority: NOR
Component: syntax
Assignee: kwrite-bugs-null at kde.org
Reporter: soft.liquid_0p at icloud.com
CC: walter.von.entferndt at posteo.net
Target Milestone: ---
SUMMARY
The R language has a base integer type (in addition to the base numeric for
floating point); this is specified for a constant by adding an "L" after the
integer (e.g., "3L"). Such constants are not highlighted by the current r.xml
syntax highlighter, but should be.
DETAILS
The current r.xml syntax highlighter tags floating point and scientific
notation numbers, and it flags integers as numbers if they are not marked with
an "L". But integers marked with an "L" are untagged and so cannot be
highlighted except as "normal" text.
In the current r.xml definitions (language v13, Kate v5.0, name = "R Script"),
lines 110 & 111 tag Float and Int values; what's needed is another rule,
probably just before the Float one (line 110), to add an attribute (e.g.,
"MarkedInt") to L-marked integers. There's probably something more efficient,
but a RegExpr rule to match String="\b[0-9]+L" would do the trick. And then,
assuming the attribute applied by the rule isn't the same as that applied by
the Int rule, an additional entry in the <itemDatas> section would be needed as
well, to set the style for the new attribute (in my workaround version of the
r.xml file, I assigned MarkedInt cases the "dsDataType" defStyleNum, as that
style does not otherwise appear to be used for R syntax highlighting).
STEPS TO REPRODUCE
My only use of the KDE syntax highlighting definitions is in RStudio, when R
code blocks are syntax-highlighted w/in pandoc-generated HTML, so my steps to
reproduce this involve processing an R script containing code with a marked
integer (e.g., "foo <- 6L") vs an unmarked one ("bar <- 6"). When such a
script is run through rmarkdown and then pandoc, the latter applies HTML syntax
highlighting styles based on the tagging from the r.xml file, and integers
ended with an "L" have no HTML marking applied.
I can provide a file and exact steps to reproduce if needed, but this bug
should appear in any situation where integers marked with an "L" in R should be
highlighted as if they were numeric constants.
Note that if I make the changes suggested above to r.xml and pass that revised
file to pandoc (at runtime) as a customized version of the highlighting rules
for R, I see correct highlighting.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the kde-mac
mailing list