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.

Filter by
Sorted by
Tagged with
-3
votes
0answers
14 views

Can someone help in checking the file parsing logic in c++?

I have a file in the following format : Startpoint: reg_4A Endpoint: reg_49A slack (VIOLATED) -0.157 Startpoint: reg_12A Endpoint: reg_14A slack (VIOLATED) -0.12 I need to parse the above ...
8
votes
1answer
39 views

Break text into letters (regular Unicode graphemes+language specific digraphs)

In English, "Sh" is two letters. In other languages it's considered a single letter. I'm trying to calculate the length of a string in a Unicode aware way, with this in mind. I'm imagining a function ...
3
votes
2answers
107 views

C++ Building Parse Tree with Boost and Modern C++

I am writing a parser. To build up the tree, I need to find the correct type for my node based on text from my language input file. Right now, I have a map from a string (the node name) to a factory ...
3
votes
1answer
58 views

Parse data into an array of structs

I'd had a hard time getting this to work. I’d like to parse a file containing data and copy this data into a struct. The data file (test.dat) looks like this: <...
6
votes
1answer
686 views

Rust Torrent Parser

I wrote a simple Torrent file parser. The following program accepts a file and builds a Torrent structure based on the contents on the file. If the file is invalid, the app crashes (as intended). It'...
3
votes
1answer
42 views

Nested for-loops in xml parsing

I wrote program that reads and processes xml files submitted by external users. The part of the code in question iterates over xml node's children, appends a dictionary - a future row in a table, and ...
2
votes
1answer
28 views

Apply smiley replacement filter to Pandoc but not in code segments

I wrote a filter for pandas that converts :-) to but not in inline code or code blocks. Pandoc makes it so the ...
2
votes
0answers
35 views

Ensuring a valid JavaScript string in security-critical application

I'm writing an application where users can write custom expressions which are then converted to JavaScript functions and executed. The expressions are used for filtering and sorting data from a ...
4
votes
3answers
366 views

Python process tracklist, get cumulative timestamp of each track

The code below parses a tracklist (sample input below) and generates a six-member tuple, including cumulative timestamps in mm:ss. (sample output at bottom). ...
3
votes
2answers
53 views

script to check sequence number in a binary file

This is a script to check the sequence number (8 bit unsigned integer) in a binary file and make sure it is incrementing till the end and not missing any sequence number in between. Sequence number is ...
3
votes
1answer
111 views

Function to parse VB.NET Like pattern

VB.NET has a Like operator with a paradigm similar to the standard SQL LIKE expression (SQL Server, SQLite, MySQL), but with a ...
9
votes
6answers
524 views

Parse a simple key=value config file in C

Write a program that should read a file formatted strictly like this below: $ cat sample bingo=2 bingo2=939 bingo3=text The left and right side of ...
4
votes
1answer
71 views

Tab 2 spaces convertor (for markdown)

This program converts glob files' tabs to spaces. There is a special case to ignore content inside triple back ticks. Example usage is ./tab_2_spaces.py *.md Main ...
2
votes
0answers
31 views

Command String Parser

I'm working on a library that, in essence, splits a string at whitespace, with extra rules: Consecutive whitespace is collapsed, and trimmed at the start and end. Whitespace wrapped in quotes is not ...
4
votes
1answer
92 views

Footwear scraper

I've done this parser to scrape all footwear data, but I don't know if it is good to use OOP in this case. Can you please check this out and give me the strongest feedback? I'm working on improving my ...
11
votes
3answers
2k views

Convert a string like 4h53m12s to a total number of seconds in JavaScript

At the moment I have this: ...
1
vote
0answers
29 views

git status parser using regular expressions in javascript

I'm looking for improvements of a code that filter the output of git status --ignored and git status --ignored -bs commands. I ...
4
votes
2answers
196 views

Parser for STL stereolithography data files [closed]

I'm parsing STL files to load the coordinates. My code is: ...
4
votes
1answer
55 views

Wavefront 3D Obj parser/viewer

For learning Rust I decided to make a 3D .obj viewer. I wrote a simplified OBJ parser without materials that only supports triangles. Considering I'm completely new to Rust and don't really know ...
6
votes
4answers
1k views

Parse source code of the RAPID robot-automation language

I am new to C, and I have very little formal education on programming (Although I am currently in college). I work as a Robot Automation technician, and me and my team are required to document a lot ...
2
votes
1answer
62 views

JSON Parser, pulls data from a JSON file for analysis

This is the first time I have programmed something that I will actually personally use, so I am happy about that. I tried to write good code whilst applying functional programming concepts. So no ...
17
votes
5answers
4k views

Speeding up thousands of string parses

I have a mapping application which takes string arguments in the form of string arrays. I parse these and then perform an action on the map. One of these is ...
4
votes
1answer
113 views

Email Generator

I've made a email generator, that uses a HTML template and replaces keywords in the template with information taken from a database. I'm looking to see if there is a way to improve the coding. ...
1
vote
2answers
76 views

Parse date format in Pandas using Python

I have a column in a Pandas Dataframe containing birth dates in object/string format: 0 16MAR39 1 21JAN56 2 18NOV51 3 05MAR64 4 05JUN48 I want to ...
3
votes
0answers
60 views

Reading and parsing binary file from CAEN Digitizer (written by WaveDump)

Preliminaries I have CAEN Digitizer N6720A and use WaveDump software for the data acquisition and recording. As a result of data recording this software produces a binary file in which the sequence ...
6
votes
2answers
117 views

Compact command line argument parser : Revisited

This question is a follow up to my previous one which can be found here. The user dfhwze suggested me to look into compiler construction and recommended me to write a lexer and a parser that would ...
-2
votes
1answer
86 views

Parse header information [closed]

Concrete Context: I parse the header information from curl execution/request and get the array named $headerARR. At this point it looks like the next example, but ...
2
votes
1answer
103 views

Compact command line argument parser

So, I decided to write my own little command line argument parser for various other projects I work on. I am aware that there are many good command line parser libraries, but I did wrote my own anyway ...
3
votes
1answer
147 views

A simple TCP command executer

In https://github.com/pc-magas/tcp_command as an attempt to learn C++ I made a simplistic TCP server in GNU/Linux that will receives simple "commands" in ASCII form. Each command ends with '\n' and a ...
3
votes
1answer
76 views

Parsing Game Entities

Could use some help with my presentation in Software Development. I'm presenting how I reworked a game's parser (SpaceTaxi). Basically we take in a .txt file with ASCII characters and convert them ...
10
votes
1answer
317 views

Credit card validation in C

I am relatively new to C programming and I am currently working through the CS50 EDX course. The problem I have solved below is for week 1 (credit). Any suggestions on how to improve this code to ...
5
votes
0answers
66 views

Parsing Long Excel Report Files for Predefined Results

I work as an IT intern in a multinational and I was given a tedious task of combing through a 2500+ long multi-column excel report file in search of inactive servers. Here's a sample row from that ...
5
votes
1answer
67 views

Try Parse Multiple Types

I am trying to write a method that takes in a String and returns an Object. The catch is I want to parse it to one of a few ...
3
votes
1answer
36 views

helper function to determine if html text is wrapped with a certain tag

I have this code that I've made to parse a string of HTML and tell me if it is all enclosed within a specified tag: ...
9
votes
2answers
128 views

Extract Information from Egyptian National ID

I did a script to extract information from the Egyptian national ID, e.g. national id is 14 digit ex(29501023201952). It could divide as described below: ...
1
vote
1answer
57 views

Getting the count of how many times a route has been hit

I have this log file (example below) and I'm trying to find the number of times a particular route is called. Example log file: ...
6
votes
3answers
252 views

Function to extract float from different price patterns

I've got a project where I get product data and need to get the prices which come in, in different formats. Some examples would be: US$17, USD17.00, 17,00€, 17€, GBP17, Only 17,-€, 17.000,00€, 17,000....
6
votes
1answer
87 views

Simple function to create Tokens from user input

I am new to programming in Rust and as an exercise I was making a simple Lottery checker program. It has a simple menu, the user enters a number for the corresponding option such as 'Add a line', '...
4
votes
2answers
87 views

Simple INI file parser in Haskell

I've written a rudimentary parser for INI files: ...
8
votes
1answer
161 views

Lazy, Functional Parser Combinators

Parser Combinators are the amazingly elegant way to write parsers that has evolved over on the functional programming side of the world, but have been less available or accessible for imperative ...
2
votes
1answer
64 views

Union based encoding of .csv file into a data table with different types [closed]

I am writing a program that has a row-based data table class. It also has an encoder class that is intended to take in some .csv data and convert it into a 2darray of encoded data of unknown type at ...
5
votes
1answer
38 views

Analyzing a web access log to obtaining totals for requests

This program takes the filename as the input and outputs to a file the number of requests that were more than 1000 bytes and the total bytes. Log file example: ...
2
votes
2answers
67 views

Split calculation string into parts

Our professor has given us the following task (its part of a bigger document full of tasks): Write a function in C that handles strings like "233+343" and parse them into the variables "iNum1", "cOp" ...
9
votes
2answers
534 views

Extracting the parent, leaf, and extension from a valid path

Powershell has the Split-Path cmdlet which allows you to extract the Parent and Leaf of a file. In PS version 6, you can extract the extension, with the ...
5
votes
2answers
102 views

Parsing parameters for a potential function

Background A forcefield is a collection of functions and parameters that is used to calculate the potential energy of a complex system. I have text files which contain data about the parameters for a ...
2
votes
1answer
38 views

Determine if a String can be parsed to LocalDateTime or Int

I have the following kotlin function that takes in a string "value", then attempts to parse "value" as both a LocalDateTime and an Int. It returns a Pair of the parsed value of "value" and an enum ...
3
votes
0answers
133 views

Extract the IP address from the output of ipconfig when connected to multiple wireless networks

I am trying to extract the ip address of my machine when connected to multiple wireless networks. The motivation here is then I can make a socket connection on that ip when I have two networks that ...
3
votes
1answer
73 views

Settings class implementation

I have a settings.txt file with the following format: ...
3
votes
0answers
54 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
72 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 ...