Parsing refers to the action by software of breaking an artifact into its constituent elements and capturing the relationship between those elements.

learn more… | top users | synonyms (1)

45
votes
11answers
9k views

Nesting versus GOTO: which is better to avoid?

In Java they're not really known as GOTO statements and are rather referred to as Branching Statements, but I find that the former term is a bit more indicative of ...
25
votes
1answer
2k views

Yet another C++ JSON parser

This is a framework for a JSON parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: ...
20
votes
6answers
17k views

Parsing console application arguments

This is how it's done in our console app: ...
17
votes
5answers
2k views

Validating opening and closing bracket pairs

I have refactored one of my old homework assignments (mainly to utilize std::stack and some C++11), and I'm still having trouble making it less repetitive. It ...
16
votes
5answers
1k views

Parse webpage and save fetched images to a directory

I had a task for a programmer position which I failed. I am a newbie programmer and I accept that. The only problem is that employer never told me what the actual problem with the code is. So maybe ...
16
votes
3answers
2k views

Look 'ma, I can read code

I have put together a naive implementation of a VB6/VBA parser, and I'd like to see if the CR community sees the same things as I see can be improved with this code, before I start refactoring. I've ...
15
votes
5answers
685 views

Parsing CSV to specific format

I've written this code to read CSV files written to a specific format. I would like to gather some feedback on where it could be improved. I'm trying to get into the test driven development ideology ...
13
votes
4answers
2k views

How to shorten this terrible HTTP header parser?

I am trying to read a line ending in \r\n from a Handle. This is an HTTP header. I’m fairly new to functional programming, so I ...
12
votes
3answers
175 views

SQLConnect - A library for connecting Objective-C/Swift applications to Microsoft SQL Server

The complete SQLConnect library can be found here. The file from which the following method belongs can be found here. At some point I may or may not open questions for reviewing other aspects of ...
12
votes
1answer
373 views

Parsing numbers from equations into strings

This is my first code in C++. Since I'm new to the language, I'm just looking for pointers on what can be made better. I tried to cut out unnecessary stuff, but there are some comments in there. I ...
11
votes
7answers
2k views

Parsing a file for a game

Is this code good enough, or is it stinky? ...
11
votes
2answers
173 views

Parsing Valve Map Files (VMF) into a tree like structure

I've written a small library of objects for parsing of Valve Map Files (VMF). These files are always generated and exported from either the Hammer World Editor, or a Source engine built in map making ...
11
votes
2answers
838 views

More efficient way to retrieve data from JSON

I am using the jsmn JSON parser (source code) to get some text from a JSON. jsmn stores the data in tokens, but the tokens do not hold any data, they just point to the token boundaries in JSON string ...
10
votes
3answers
353 views

Parsing ARP cache in C

How can I make this better? ...
10
votes
2answers
435 views

C-style language lexer for a syntax highlighter

I'm working on implementing a syntax highlighter for a simple text editor I've been working on. To do this, I need a simple lexer for various languages (I don't need a full one - I'm only interested ...
10
votes
3answers
569 views

Read a space delimiters settings file in C

I'm a C# programmer and I would like to start getting better at coding in C. I wrote a function which reads a space delimiters settings file (supports comments / and #). The code works fine. But from ...
10
votes
4answers
10k views

Simplify splitting a String into alpha and numeric parts

Requirement: Parse a String into chunks of numeric characters and alpha characters. Alpha characters should be separated from the numeric, other characters should be ignored. Example Data: Input ...
10
votes
4answers
847 views

LL(1) tokenizer for LISP

I am trying to write a LISP interpreter in C#, so I started with a tokenizer. I haven't finished it yet (have to handle floating point numbers, symbols), but I already rewrote it two times because I ...
10
votes
1answer
138 views

Configuration file with Python functionality

I'm working on quite complicated scientific project. I decided to use a configuration file for model description. However it was quite complicated to parse all strings after ...
10
votes
2answers
1k views

Math expression solver

Recently I've stumbled upon an interesting challenge for me. You should develop C application, that solves math expressions. Operations such as (+,-,*,/) should be supported, as well as (cos, sin, ...
10
votes
2answers
94 views

Parsing of a (Linux) netlink hotplug uevent packet

The netlink service is used, among other things, to notify userspace about hotplug events (e.g. "a device has been connected"). These events come in the form of packets, which follow the following ...
10
votes
1answer
109 views

Processing C++ comments

Here's the first functional version of my Python 2 script for processing comments in C++ source files. It's a personal project, I expect to expand it later with more advanced options (mainly about ...
10
votes
1answer
331 views

Idiomatic clojure code in a markdown parser

Some time ago I created a markdown parser in clojure and I would like to get some feedback, since I'm a clojure noob in the first place (is the code understandable?/is it idiomatic?/can some things be ...
9
votes
3answers
257 views

Parsing comma-separated floats and semicolon-delimited commands

I wrote a cstring parser. It has to work with a relatively wide amount of arguments (usually 3 or 4, but maybe in future with a different amount), which are ...
8
votes
2answers
410 views

Object Creation during loops

I'm trying to parse a CSV file into objects. I've already got a very efficient CSV parser (SuperCSV). The problem arises when trying to create the object with the data that is being read out. I've ...
8
votes
1answer
2k views

A boolean expression parser, written in Java

I was trying to write some of the Haskell list functions into Java, and I realized that one of the key strengths for many of the functions was the ability to pass in a boolean expression. I decided to ...
8
votes
1answer
106 views
8
votes
1answer
183 views

Locale-related code — are there corner cases I didn't see?

This is a utility class I have in one of my projects and I seek feedback on it. I have read the javadoc for Locale quite a few times while developing this code. I ...
8
votes
2answers
226 views

Serializing JSON data coming from two URLs in the same object

I have two URLs (urlA and urlB) and both the URL gives me a JSON response back in the same JSON format. Below is my JSON string ...
8
votes
1answer
90 views

Reduce duplicate sequences

I am writing a copy paste detector using esprima.js and Hmm. This particular function checks a number of sequences and reduces them. Due to the parsing I might have 2 sequences with the same piece of ...
7
votes
5answers
927 views

Reading from text file with RegexMatch

Below is the method that I have written for reading from a text file. While reading, I need to match line string to given regex and if it matches then I need to add the line string to a collection. ...
7
votes
2answers
377 views

Optimizing this inefficient TicTacToe configuration parser

On a programming contest I came upon this question: Given a partially played 3 × 3 tic-tac-toe configuration, write a program to determine which player will have a better chance of winning if the ...
7
votes
2answers
585 views

Digit to words converter

This is one of the longest programs I have made with methods and I think I must be doing this rather inefficiently. Any comments to improve would be appreciated. ...
7
votes
4answers
195 views

Looping Strategy: Change behaviour after first iteration

I have often encountered the following situation. I want to call a method in a Loop, but want to skip the call at the first run. It do not have to be a method, it also can be some lines of code that I ...
7
votes
2answers
507 views

Parsing CSV file with BufferedReader vs Scanner

I have to parse file line by line and in single line I have split by ",". First String would be Name and Second would be count. Finaly I have to display the Key and Count For example ...
7
votes
2answers
502 views

Are there any ways to improve my HTTP request path parser?

I have written a method to tokenize HTTP request paths such as /employee/23/edit. ...
7
votes
2answers
92 views

Splitting plain text dictionary data to multiple files

I have a plain text file with the content of a dictionary (Webster's Unabridged Dictionary) in this format: ...
7
votes
2answers
120 views

Token-finding function

I want to make sure find_value_from_key() is safe and efficient. My constraints are language C++, use of standard library ok, but cannot use Boost or any new C++11 ...
7
votes
3answers
150 views

VB6/VBA Declaration (Dim) Syntax Parser

As part of a project I'm working on, I've implemented a class that encapsulates the syntax for a vb6/vba Dim statement. Given a line of code, the ...
7
votes
1answer
292 views

getfloat, the floating point analog of getint

Write getfloat, the floating-point analog of getint. What types does getfloat return as its function value? gefloat would also return an integer value. Here is ...
7
votes
2answers
110 views

Social Media Hashtag Splitting

I decided to try out Python (3.x) two or so weeks ago, and this is my first real script using it. The program I've written below is slow, clunky, inefficient, inaccurate, and probably poorly coded! ...
7
votes
1answer
204 views

Clojure tokenizer

Please review the following Clojure tokenizer. The goal is to study Clojure, so sometimes I re-implement functions (it will be nice to see standard functions for this). Beyond of this, code seems ...
7
votes
2answers
153 views

Hello Java World ~> Parsing a Sudoku Grid

This is my first, very-very first attempt at java. I haven't started tackling the actual resolution of the sudoku puzzle (not even sure where to start, haven't looked at other weekend-challenge ...
7
votes
3answers
178 views

Rigidness and verbose nature of XML parsing

I've been developing a simple console application in C++ using the TinyXML2 library, and I honestly can't help but feel what I'm doing is not very robust. Maybe that's just the nature of parsing XML ...
7
votes
1answer
926 views

Parse Java source code

I have a bunch of simple interfaces like this one (pretty enough formed, but not guarantee) ...
7
votes
2answers
668 views

Scripting language parser

I'm making a scripting language parser and it's shaping up well but it takes about 30ms to do 30 or so odd/even checks. Profiler tells me that it's taking most of ...
7
votes
1answer
572 views

A C++ PEG parser generator

I wrote a C++ PEG packrat parser generator and would love to get some feedback on the code and/or syntax. I currently use the << operator for defining grammar ...
7
votes
1answer
409 views

HTTP Authorization header parser

I'm writing a parser for HTTP Authorization header (see RFC2616#14.8 and RFC2617#1.2). Note that I explicitly don't care about the base64-encoded syntax used by HTTP Basic authentication. I'm only ...
6
votes
2answers
2k views

Same code to parse int, float, decimal?

I have a method to parse strings. It can be used to parse a float using a specific culture ...
6
votes
2answers
5k views

Read an input text file and store the tokens in 2 different arrays

I am very new to Java so please ignore if there are obvious mistakes. If my question seems redundant then please guide me towards the correct link. However, I have surfed enough in order to find the ...