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)

43
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
16k views

Parsing console application arguments

This is how it's done in our console app: ...
16
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
605 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
1answer
360 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
153 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 ...
10
votes
4answers
9k 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
836 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
131 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
745 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 ...
9
votes
3answers
324 views

Parsing ARP cache in C

How can I make this better? ...
9
votes
2answers
417 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 ...
9
votes
3answers
565 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 ...
9
votes
3answers
237 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 ...
9
votes
2answers
917 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, ...
9
votes
1answer
101 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 ...
9
votes
1answer
307 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 ...
8
votes
2answers
406 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
178 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
1answer
87 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
691 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
364 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
436 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
192 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
397 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
497 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
118 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
116 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
249 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
91 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
185 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
143 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
169 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
910 views

Parse Java source code

I have a bunch of simple interfaces like this one (pretty enough formed, but not guarantee) ...
7
votes
2answers
666 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
535 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
332 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
4k 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 ...
6
votes
3answers
313 views

Coderbyte SimpleSymbols challenge in Javascript

I am working on a CoderByte problem in JavaScript. I have solved the problem below. Although I am trying to figure out if there is an easier way to do it? I am guessing RegEx will come up, although I ...
6
votes
2answers
1k views

Slow-running File parser

I've got a method that parses a file. I take all the words and add them to a SortedSet. Every word contains a list of Lines ...
6
votes
1answer
515 views

I need help scrubbing this code down, parsing a file.

Note: This file is out of my hands. I cannot change the format or type of file I have to parse. Here is some sample data that I'm trying to parse. This is information for just one player: ...
6
votes
3answers
118 views

Pattern tokenization program

I am writing this program to try and get some practice at C++ and correct and proper styling. This code is meant to take user input from a pip and then run it through the program. The user enters a ...
6
votes
2answers
97 views

Simple CSS Parser

I wrote a very simple CSS parser and would appreciate some general feedback regarding the security, code style etc... Basically, this does the following: Take user's uploaded CSS file Save it to ...