Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [parsing]

Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

3
votes
1answer
49 views

Settings class implementation

I have a settings.txt file with the following format: ...
3
votes
0answers
29 views

Parsing version from Cargo.toml

I want to get version from Cargo.toml and use the value inside my app. Here is a function I wrote: ...
2
votes
1answer
66 views

.NET Custom hierarchical expression to treeview data structure

I'm not good at English. It's gonna be hard to read. I apologize in advance. I need expression parser for draw diagram(fault tree). In order to do that I have to create data structure from ...
12
votes
1answer
1k views

Factorio analysis: data munging

This project is... a little ridiculous. It's working, but it's a complete mess. Data about Factorio's game economy are pulled from the wiki via the MediaWiki API, scrubbed, preprocessed, and thrown ...
6
votes
2answers
91 views

C++ Saving And Loading Data For A Game To a Text File Using fstream

So i have written this code to save and load data for my C++ game to a file, this way I don't have to hard code every single room and item for the game. Essentially here's how the game works: So you ...
6
votes
1answer
185 views

Overloading istream>> to read comma-separated input

I have the following very simple class: ...
5
votes
2answers
88 views

Parsing pairs of a number or number range

I need to process an array of number pairs. Here are the constraints on the pairs: The second item may be missing, in this case 0 will be used as second item - - 38...
1
vote
0answers
37 views

AST Visitor Pattern in Java

I am trying to make a simple expression evaluator in Java using Jacc (a parser generator). I am done with the AST creation and now need to create an evaluator. For this I made a simple test to try to ...
6
votes
3answers
97 views

Method to remove comments from a string line

There is some language where the following are considered comments: [str] // comment [str] /* comment */ [str] ...
3
votes
2answers
31 views

Parse a date in various formats

I have a problem similar to the question, namely reading in text which describes a date - in various formats. I want to use the parseTimeM function from ...
1
vote
1answer
34 views

Substituting variable placeholders that may be intermixed with HTML tags

I needed to substitute variables of the syntax {FIRST_NAME} in a HTML template. The problem is that the template comes from a WYSIWYG system, and so the ...
6
votes
2answers
89 views

Parse dblp XML and output sums of publications grouped by year and type

The following Go program parses a gzipped XML file (available here) which contains bibliographic information on computer science publications and has the following indicative structure: ...
2
votes
1answer
56 views

(Codewars): Find the Unknown Digit

Kata: https://www.codewars.com/kata/find-the-unknown-digit/train/python To give credit where credit is due: This problem was taken from the ACMICPC-Northwest Regional Programming Contest. Thank ...
2
votes
1answer
45 views

segstr - Get delimiter-separated segments from a string in a non-destructive method

I wrote my first useful function in C which can be used in a different variety of situations as an alternative to common code logic. segstr (originally named ...
6
votes
4answers
684 views

Parsing a string of key-value pairs as a dictionary

I always use nested list and dictionary comprehension for unstructured data and this is a common way I use it. ...
1
vote
1answer
57 views

Parsing a string to a java LocalTime

I have a method that can take in a time string in one of the following formats: HHmmss - e.g. 073055 = 07:30:55 ...
2
votes
1answer
51 views

Dynamically Generating XML Deserialization Classes / Code: Part I, Reading

I'm building an IntelliJ Plugin which will allow a person to select an XML file (and even a snippet of XML in the file, if they like) and, using a really brief GUI, generate classes / code in one of a ...
10
votes
2answers
137 views

Javascript cron-to-human-readable translator

I'm developing a webpage displaying the scheduled pipelines from all projects of a GitLab instance. The scheduled time is expressed using CRON expressions, i.e. five digits as follows: Because not ...
2
votes
0answers
92 views

Esoteric programming language in Ruby

I have recently created an esoteric programming language called 01 and I will be grateful for a code review and any opinions or suggestions about the future of this language. GitHub ...
1
vote
1answer
37 views

Token generator for Valve Data Format parser in Java

I'm looking to parse a reduced subset of the Valve Data Format (VDF). It is similar to JSON, allowing representation of key-value collections (maps) with arbitrary recursion. As a small example: <...
4
votes
0answers
41 views

Wrapping argparse to use configuration file

I want to be able to both provide options through command line and from a configuration file. A single option could be served either by the user or by the configuration. But if is provided by both, ...
4
votes
3answers
83 views

if you gaze long enough into strtok, strtok will gaze back into you

The tokenise function below splits a given string at the indicated delimiters. As with strtok, it modifies the string by adding <...
9
votes
2answers
859 views

Parse and TryParse methods for phone numbers [closed]

Let's assume I have a class PhoneNumber which accepts phone numbers in the format "123-456-789" (3 groups with 3 digits each, split by dashes). Now, I want to ...
7
votes
1answer
46 views

Perl one-liner for parsing host names from ssh config file

Here is the working code (intended to be executed with perl -e '<code>' ~/.ssh/config): Actual version: ...
8
votes
2answers
463 views

Chemical Formula Parser

As an exercise, I wrote a simple context free parser modeled from a pushdown automaton for chemical formulas such as NO2 or ...
2
votes
1answer
41 views

A faux parser for fdf files

Introduction If you know what FDF files are, you can skip this section. PDF files sometimes includes form fields. These fields can be represented as FDF in plain text form, extracted using certain ...
2
votes
1answer
75 views

Creating objects from xml-data

I've got an XML file with some info about hosts connected to my home network and I would like to create objects containing that info in a neat way, so that I can make some nice front-end application ...
0
votes
0answers
58 views

XLSX to CSV script with column re-ordering

I am still learning Ruby and object oriented programming. I wrote an Excel Export CSV Parser script, which does the following: reads an XLSX file creates a temp file re-orders columns generates a ...
3
votes
0answers
89 views

C++ program that processes unique markup language similar to HTML

I have solved a task which takes input in a unique markup language. In this language each element consists of a starting and closing tag. Only starting tags can have attributes. Each attribute has a ...
3
votes
1answer
107 views

Infix to postfix notation in Haskell (Shunting-yard algorithm)

I've written an infix to postfix converter in Haskell using the Shunting-yard algorithm. Example of how it works: ...
1
vote
0answers
44 views

Parsing expressions with combinators

I'm very new to Haskell's ReadP library, and the entire concept of parser combinators, so I was wondering whether there are better ways to do some things in this program: ...
2
votes
0answers
28 views

Convert flat object hierarchy to json

I do work for a project currently, where the data is send to the server as application/x-www-form-urlencoded (which is bad, and it should be JSON, but unfortunately I am not able to change this one). ...
5
votes
1answer
71 views

Replacing Uri with a more convenient class

I needed some data structure for holding Uris so I thought I try the Uri class. It quickly turned out that it's very impractical because: it's missing an implicit ...
1
vote
1answer
47 views

Parse html bookmarks export to a json with python for further management

I made this piece of code as first step for a bigger project to iterate and manage bookmarks: open, rename, place in new folder structure, or delete each one of them. This first step is a parser to ...
3
votes
1answer
58 views

Generating report columns from SQL query

I've written this class to create RapportColumn objects for each column that is written in the query. And I would like to get your feedback. The query that is ...
7
votes
0answers
74 views

Visual Studio exception visualizer for lengthy exception messages

I use Autofac a lot and for everything and when you make a mistake and forget to register a dependency etc. it'll tell you exaclty what's wrong. Although its ...
2
votes
2answers
55 views

Parse IP address from a GPRS module reply

I'm writing a parser to get the IP address from a string I get from a GPRS module. Examples of the string I get from the GPRS module: +QIACT: 1,1,1,\"10.162.143.228\"\r\n\r\nOK\r\n +QIACT: 1,1,...
3
votes
1answer
260 views

COBOL layout parser in Python

I don't know anything about parsers but I had to write something to read COBOL for a work project. What are some things that I could improve with my Python coding and parser design? Note: This isn't ...
0
votes
1answer
214 views

Parsing messages with fixed-width fields into Employee objects

I'm writing a application that reads from a queue of messages from a legacy mainframe system. Some characteristics of message in the queue: Message from the Q is always fixed length plain text : 64 ...
2
votes
1answer
79 views

Parsing a C++ function declaration with Perl 6 grammar

I wrote a Perl 6 grammar to parse a C++ function. My final goal would be to parse an entire header. The aim is not to correct C++ syntax errors, but to parse valid C++. Do you have some advice or ...
4
votes
1answer
46 views

Search for ways in OpenStreetMap extract

What does it do ? Looks in big XML files (1-3 GB) for given parameters that I need in my project, appends them to lists and finally exports both of them to the CSV files. My XML scheme I need to ...
2
votes
0answers
46 views

DOS header parser in Rust

Looking for feedback mostly on the from() and printf() implementations but I included everything for context. Please do not ...
1
vote
0answers
117 views

Swift NMEA parser

I'm quite new to Swift, and although I've been programming as a hobby for many years, I'm still not very confident about my code. I'm currently rewriting an old library of mine, an NMEA parser. NMEA ...
3
votes
3answers
144 views

Parse a GET or POST string in C

This function takes a string from an HTTP POST or GET string, finds the specified variable, and allocates memory for the result and puts it in a string. The destination is given as an address of an ...
-1
votes
1answer
74 views

Remove lines from csv if duplicate value in column [closed]

i am trying to write csv parser so if i have the same name in the name column i will delete the second name's line. For example: ...
6
votes
0answers
102 views

Flight API querier

I am learning Go and wrote a small application that queries the Skyscanner API as my first attempt at learning. I was hoping someone more expert than me in the language could look over it at broad ...
6
votes
2answers
141 views

Minimalistic, self-contained class for reading a sectionless INI file

When sections are ignored and no writing capability is needed, an INI reader becomes quite simple to implement. Here is my attempt at reading a sectionless INI file without any non-...
2
votes
4answers
243 views

Split a string into a list of tokens

I have the following assignment that I succeeded in solving, but the code is very inefficient. I would appreciate if someone could show me a more efficient way, perhaps with substring. Note that I am ...
0
votes
2answers
99 views

Convert HTML input string to JavaScript Array literal

I am trying to accept JavaScript array literals in an HTML text input. The problem is that HTML text inputs are captured as strings, such that an input of ...
9
votes
1answer
86 views

Minimal regex engine

A few months back, I posted a state machine for review. Thanks to the feedback, I was able to greatly simplify the implementation. I am posting the revised version, together with the Regex class which ...