Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
87 views

I am attempting to scan specific names from a CDL file (a variant of SPICE) which is a line oriented syntax. Superficially, regex would work, but is in fact more complex given the full language ...
Robert Heaton's user avatar
4 votes
3 answers
81 views

I'm trying to parse syllables with pyparsing. I'm working with a language that has a CV(C) syllable template, so every syllable starts with a consonant. However, my parser is "eating" the ...
sventechie's user avatar
  • 1,919
1 vote
0 answers
73 views

I'm using Pyparsing and I'm getting a reportArgumentType error from Pyparse: from dataclasses import dataclass import pyparsing as pp @dataclass class Foo: value: int def parse_foo(line: str) -&...
Leonardo's user avatar
  • 2,019
1 vote
1 answer
27 views

I couldn't find this anywhere. I'm using pyparsing on a project right now and I need to match keywords at the start of the line. I looked at the LineStart for this which is close but not quite the ...
CodeMonkey's user avatar
  • 4,966
1 vote
1 answer
142 views

I'm trying to parse data in the following format: data = """\ map=1 sub=1 int=99 foo=bar sub=2 foo=bar int=99 bar=qux """ I based my grammar on ...
Soós Péter Levente's user avatar
1 vote
1 answer
39 views

I’m working on a Python project that utilizes moto[all] version 5.0.0 or higher for mocking AWS services in pytest test cases. Additionally, the project depends on simple-salesforce and simple-...
D007's user avatar
  • 61
1 vote
1 answer
58 views

I want to do string templating with py parsing. I have failed multiple times to define a grammar that can parse a string with inserted text inbetween "#{" and "}" (seems pretty ...
Fogux's user avatar
  • 159
2 votes
1 answer
57 views

I am using pyparsing to parse sass files. I need to get the sass files into a particular format to work with them, and preserving whitespace is very important. import pyparsing as pp pp.ParserElement....
Ben Alan's user avatar
  • 1,751
2 votes
1 answer
126 views

I'm currently trying to write a parser (using pyparsing) that can parse strings that can then be applied to a (pandas) dataframe to filter data. I've already got it working after much trial & ...
Olorun's user avatar
  • 491
1 vote
1 answer
66 views

Below is my pyparsing grammar for parsing the method signature of a Solidity function, and an example signature to parse: from pyparsing import Word, alphas, alphanums, oneOf, Group, Forward, ...
aram10's user avatar
  • 23
1 vote
1 answer
103 views

I am learning Paul McGuire's fabulous pyparsing Python module. I'm posting this for discussion and hopefully to get a deeper insight into pyparsing. The following code parses a parenthetical ...
Jay's user avatar
  • 87
2 votes
2 answers
763 views

In attempting to put together a very simple example to illustrate an issue I'm having with pyparsing, I have found that I can't get my simple example to work - this example is barely more complex than ...
Michael Henry's user avatar
1 vote
1 answer
116 views

Pyparsing offers the ParseElementEnhance subclass DelimitedList for parsing (typically comma-separated) lists: >>> kv_element = pp.Word(pp.alphanums) >>> kv_list = pp.DelimitedList(...
FeRD's user avatar
  • 2,211
1 vote
1 answer
80 views

I've got a generic "text block" element, for which I copied the whitespace-stripping code from the documentation: import pyparsing as pp text_block = pp.Group( pp.OneOrMore( pp....
Michael Henry's user avatar
1 vote
1 answer
55 views

I have a simple markup grammar that can have matched and standalone tags: {tag}Tagged content{/tag} plain text {standalone}{tag}Tagged again!{/tag} I wrote the following pyparsing grammar: import ...
Virgileo's user avatar
1 vote
1 answer
63 views

I'm using pyparsing 3.0.9, python 3.9.16, and I'm trying to write a grammar for a (sub-)set of YAML. Not so much for the produced parser, as for the railroad diagrams. The actual state of the program ...
jcoppens's user avatar
  • 5,470
1 vote
2 answers
72 views

I'm trying to implement simple shell-style string variable interpolation with $varname syntax, using pyparsing. For example, if I have a variable foo with value "bar", then transform "...
satwell's user avatar
  • 284
1 vote
1 answer
70 views

I wrote a little parser using pyparsing to parse Google-like search strings, like foo AND (bar OR baz) (full code below). Like Google, I would like to make the parser fully fault-tolerant. It should ...
medihack's user avatar
  • 16.7k
1 vote
1 answer
46 views

I want to parse strings like alpha OR beta gamma where a missing operator (in this case between beta and gamma a implicit AND is used. Here is the code I tried: import pyparsing as pp class Term: ...
medihack's user avatar
  • 16.7k
2 votes
1 answer
77 views

I'm trying to match a sentence fragment of the form "after 3 days" or "after 1 month". I want to be particular with the single and plural forms, so "1 day" is valid but &...
BruceH's user avatar
  • 516
1 vote
1 answer
88 views

I'm working on implementing a parser that is supposed to process the input string, extracting its components, validating them, and then creating a SQL Alchemy query from it. At the moment, I'm working ...
PyJaGa's user avatar
  • 23
1 vote
0 answers
61 views

Ive created a very large PyParsing tree from reading ISB Bind9 named.conf file. Now I wish to redirect my attention to generating an output back to the way it was syntactically read and created from. ...
John Greene's user avatar
  • 2,718
1 vote
0 answers
43 views

IndentedBlock from pyparsing not dedenting I am trying to write a parser in pyparsing that has a container that has optional contents, and I'm not getting the results I'm expecting. Here's the ...
amertune's user avatar
  • 690
1 vote
1 answer
59 views

I am trying to parse and read the components of a complex select statement based on the select_parser.py example, but I cannot seem to make it work for a select statement with a UNION. My sample ...
Sheldon's user avatar
  • 13
1 vote
0 answers
112 views

I'm getting the follow dependency error when attempting to import tensorflow on a jupyter notebook: AttributeError: module 'pyparsing' has no attribute 'downcaseTokens' The full error message is: ...
user23304335's user avatar
1 vote
0 answers
35 views

I observe a difference in the results between runTests as a string and when reading from a file . This is the code that I have import pyparsing as pp import sys from pathlib import Path # Largely ...
Harihara Vinayakaram's user avatar
1 vote
1 answer
94 views

2.2.1 I am a newcomer to PyParsing. I use Python 3.12 on Ubuntu 20.04 and installed PyParsing using pip install I have 2 different outcomes (an exception from 1 ) and no exception from from 2 ...
Harihara Vinayakaram's user avatar
1 vote
1 answer
117 views

I'm trying to parse some commands-like string/file content into a Dict output and I learned about pyparsing. So let's say I have the following input: str = "p1 start a, {alias = b, for : 30}; c, ...
DZkid's user avatar
  • 158
0 votes
1 answer
51 views

I need to specify an expression that is defined as ambn, such that: m + n = t; t is fixed 0 <= m <= t - 1 1 <= n <= t Here's how the current code looks like, simplified: from pyparsing ...
InSync's user avatar
  • 12.2k
0 votes
1 answer
92 views

I have a string which looks like the following. """ 1: a 2: a, b 3: a, b, c """ I would like to use pyparsing to define a grammar which is dynamic and picks up the ...
lattitude's user avatar
  • 157
2 votes
0 answers
58 views

I am learning PyParsing and just tried to run the example Python file for creating Railroad diagrams but the output looks wrong. Basically, I downloaded the code from https://github.com/pyparsing/...
ExactPlace441's user avatar
1 vote
1 answer
79 views

I have no ideas why pyparsing produces different results for asDict() and asList(). Please push me in the right direction. import pyparsing as pp WALRUS = pp.Keyword(':=').suppress() number = pp....
DamirX's user avatar
  • 23
1 vote
1 answer
78 views

The problem I have a bunch of Group-ed expressions like these, all of which contribute to the same grammar: first_and_operator = Group(Char('ab')('first') + Char('+-')('operator')) full_expression = ...
InSync's user avatar
  • 12.2k
1 vote
0 answers
90 views

I'm trying to parse a relatively simple expression with pyparsing, but I'm getting an error that I don't understand. Here's the parser setup. I can parse user and feature separately, but combining ...
justin's user avatar
  • 181
1 vote
1 answer
63 views

I have some of these constructions in my code: from pyparsing import Char, srange _non_ascii = Char(srange('[\x80-\U0010FFFF]')) The generation of the ranges is extremely slow, taking 6-8 seconds (...
InSync's user avatar
  • 12.2k
-1 votes
1 answer
239 views

I'm building a recursive grammar using pyparsing, to express a series of possible operations, but I've hit an issue with how to express functions. I wish to describe an operator that has a name, ...
Mark's user avatar
  • 1,182
1 vote
0 answers
29 views

Why does the following pyparsing grammar not parse the string correctly? import pyparsing as pp token_any = pp.Word(pp.printables) comment = pp.Literal("*") + token_any("comment text&...
The Bic Pen's user avatar
  • 1,237
1 vote
1 answer
74 views

I'm a complete pyparsing newbie, and am trying to parse a large file with multi-line blocks describing archive files and their contents. I'm currently at the stage where I'm able to parse a single ...
JK Laiho's user avatar
  • 3,946
1 vote
2 answers
64 views

I am trying to create a parser using pyparsing that parses an expression of below formats: FUNC_NAME(ARG1, ARG2, ..., ARGN, K1=V1, K2=V2, ..., KN=VN) ARGs and KWARG values can be literals (quoted ...
seb's user avatar
  • 11
1 vote
1 answer
176 views

I need to parse Touchstone files (version 1.1, and version 2.0), but these have a strange rule in the syntax (see page 11 in the 1.1 spec, the top paragraph starting with Note. So, I need to change ...
jcoppens's user avatar
  • 5,470
1 vote
1 answer
79 views

I am developing a parser that extracts the dose and name from expressions of medication dosages. For example, pulling "10 mg" and "aspirin" from "10mg of aspirin" and &...
mac389's user avatar
  • 3,163
3 votes
1 answer
918 views

I have an oracle sql script containing multiple statements which are separated by ";". I'm trying to remove all comments within this entire script. This includes: single line comments -- ...
Chowder's user avatar
  • 126
1 vote
1 answer
117 views

In shortened and simplified pseudocode I have something like this: arg = Forward() ... ... func_call = somestuff + arg term = ... | ... | arg expression = infix_notation(term, operator_rules) ... ......
Karim Ghibli's user avatar
1 vote
1 answer
148 views

Suppose we have a grammar where there is an element that was expected but is not found. Assume that the backtracking is disabled, i.e. the element is preceded by a - sign. Is there any way in the ...
Kuba hasn't forgotten Monica's user avatar
1 vote
1 answer
967 views

C:\Coursera\CarlaSimulator\PythonClient\Course1FinalProject>python module_7.py Traceback (most recent call last): File "module_7.py", line 26, in <module> import matplotlib....
Hrishikesh k's user avatar
2 votes
2 answers
175 views

i have some input data like [gog1] [G1] [gog2] [gog3] [gog4] [G2] [gog5] [G3] [gog6] and want to find all gogs, if not G after it. so in this case i want to get gog2 and gog3 (and maybe gog6). looks ...
Jhon BYaka's user avatar
1 vote
0 answers
53 views

I am trying parse a SQL query using Python's pyparsing library. As part of that, I implemented the below code: from pyparsing import * ParserElement.enablePackrat() select_stmt = Forward().setName(&...
Torque's user avatar
  • 117
1 vote
1 answer
49 views

I am trying to apply pyparsing to solve the Advent of Code 2015 Day 19 puzzle. The simplest example shows an ambiguous grammar e => H; e => O; H => HO; H => OH; O => HH and seeks the ...
Hugues's user avatar
  • 3,206
3 votes
2 answers
236 views

I cannot figure out how to combine expressions with the comma_separated_list in order to match a list in parentheses. The following does not work, because the csv expression eats up the last ...
Ondrej Sotolar's user avatar
1 vote
1 answer
92 views

I am changing a few pyparsing patterns from pyparsing version 2 to pyparsing version 3. The contents of the sample file I use for parsing this is a sample page to test parsing line 0001 line 1 line ...
user19898808's user avatar

1
2 3 4 5
21