Questions tagged [parsing]
The parsing tag has no usage guidance.
21 questions
2
votes
1
answer
153
views
Add parsing of latex-style .el file to LaTeX-hook using AUCTeX
I did some online research (e.g. here) but couldn't figure out how to solve the following problem so far (of course, I might have overlooked something since the whole emacs community is new to me).
...
0
votes
1
answer
156
views
JSON parsing fails: json-parse-error "too big integer"
I'm trying to parse a JSON file which contains large numbers:
{
"uuid": "c73b470a-5efb-4d53-9ac6-c5f6487f227b",
"description": "grains on square 64&...
0
votes
0
answers
45
views
org-element : remove first headline with its drawer
I have a org-element AST of a subtree which I want to make into a separate file. It looks necessarily like
(org-data nil
(headline (...metadata...) ; (a)
(...
1
vote
1
answer
106
views
Lisp function to parse shebang line?
Before I probably re-invent the wheel, has anyone written a function (or perhaps there's one somewhere in Emacs already) to parse the shebang line of the current buffer (or some specified buffer). For ...
3
votes
1
answer
198
views
How can I make `forward-sexp` handle other balanced character-pairs such as < and > or << and >>?
I am trying to find an easy and efficient way to modify the behaviour of forward-sexp to handle balanced pairs of characters not normally supported by it, such as balanced < and > and balanced &...
1
vote
0
answers
315
views
How can I convert an inline pseudo YAML dictionary to a valid multiline one?
Consider this code:
- name: Cron set up
cron: name=something something="anything" job="/bin/bash -c 'service=nslcd; [[ -x /usr/bin/$service ]] && systemctl restart $service'&...
3
votes
2
answers
575
views
Check whether a string is a date in a specific format, e.g. "%Y-%m-%d"
I have a string and would like to check whether it contains a date in a given date format, e.g. "%Y-%m-%d", with format as for format-time-string. This is for a package and users can configure the ...
2
votes
2
answers
226
views
Can syntax parsing recognize the SQL '' (escape apostrophe/single quote) construct within SQL strings?
I am trying to enhance SQL mode such that editing of files of SQL code becomes more convenient, especially as far as jumping around is concerned (e.g. things like sql-goto-end-of-string etc.). I have ...
5
votes
2
answers
106
views
What is a good strategy to locating function arguments in a buffer?
I'd like to create a few routines for manipulating function arguments in buffers, which of course requires me to first locate the arguments. Suppose that I'm operating on a buffer with a programming ...
2
votes
3
answers
832
views
Split command line into a list of arguments
How do I take a string giving a shell command line such as:
"program arg1 arg2 \"long argument with spaces\" arg\\\"3"
and turn it into a list of unquoted arguments like:
("program" "arg1" "arg2" "...
4
votes
5
answers
536
views
find end of string constant
I'm using a simple (re-search-forward "\"") to find the end of string constants in my buffer. This is to copy the string in a def like (defconst name1 "some string"). The problem is that string ...
8
votes
3
answers
333
views
Split a complicated string?
Q: how do I split a complicated string when whitespace
delimiters aren't discriminating enough?
Background
I'm working with BibTeX files. I want to split an author string
of the form "first-name ...
1
vote
0
answers
262
views
Is CEDET/semantic obsolete? How to analyze C code for source transformation tasks?
Reading through some CEDET docs I found that the author herself recommends "to use Semantic only as source of information, and perform names completion using other packages". Does this advice also ...
3
votes
1
answer
1k
views
Pretty print s expressions from the command line
I've got a file containing an emacs s-expression and I want to pretty print it from the command line: Is there an easy way of doing this? Paranoia suggests I want to do as little parsing of this data ...
1
vote
0
answers
83
views
How do I read and parse other Lisps in Emacs
I am playing with LFE language and I try to improve documentation lookup. Some of my efforts can be seen on my Github repo
I have a function sexp-at-point which return a string enclosed by round ...
2
votes
0
answers
64
views
Is it possible to detect C/C++/Java variable declarations.?
I'm writing a minor mode to handle automatic spacing of operator characters, but I'm having some trouble with C/C++. The problem is that I can't figure out how to tell in general whether a * is a ...
7
votes
0
answers
1k
views
How do I parse a simple grammar and obtain a syntax tree in Emacs lisp?
How can I construct a parse tree from a string and a simple grammar? Semantic seems very tricky, and SMIE does not seem to produce a parse tree.
Here's an example, assuming a language that looks like ...
8
votes
4
answers
1k
views
How can I find surrounding parenthesis (from emacs lisp)?
Is there a way to find out the type of the surrounding parenthesis (i.e. '(', '[' or '{') around point? For example (using | to represent point)
{ abc, | df }
should return '{', and
{ abc[ | ], ...
9
votes
2
answers
278
views
Make forward-sexp recognize blocks defined by keywords, not just parentheses
In a language (julia) that has blocks defined by keywords such as for..end, begin..end, as well as parentheses, what is a good way to skip over such a block? Also, end is not only a block keyword, but ...
12
votes
2
answers
941
views
For what languages is `syntax-ppss` appropriate?
I've been looking at a way of detecting whether point is on a comment by looking at how the current buffer is fontified.
Smartparens defines sp-point-in-comment, which relies on syntax-ppss. However, ...
7
votes
2
answers
2k
views
Elisp function to see a date for next Wednesday
Admitting up front that I am not capable of much Lisp, I have found ways to produce the current date or a number of seconds from a date, but I am looking for a simple equivalent to shell command like ...