Tagged Questions
20
votes
6answers
15k views
15
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 ...
14
votes
5answers
560 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 ...
11
votes
7answers
2k views
11
votes
2answers
137 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
821 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 ...
7
votes
5answers
557 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
3answers
98 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
2answers
664 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 ...
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
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
505 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
1answer
63 views
Loop through JSON and create prefab in Unity3D
I am creating an app in Unity3D and it is my first time coding in C#.
I use the following code to parse a JSON file hosted on my server and use the information to render prefabs within my scene:
...
5
votes
1answer
209 views
First attempt at dealing with command-line args
A little while ago I was fiddling with dependency-injection and came up with this small WPF application that I can launch with command-line arguments.
Not only this was my first experiment with DI, ...
4
votes
2answers
115 views
Nested switches vs domain specific parser
I'm working on an application which has a defined and immutable (for our purposes) communication protocol. One of the features is that users on the controlling terminal can enter text commands that in ...
4
votes
1answer
177 views
Using Regex to parse a chat transcript
I need to classify each line as "announce, whisper or chat" once I have that sorted out I need to extract certain values to be processed.
Right now my regex is as follow:
...
4
votes
2answers
46 views
Short XML parser
This is my first code in C# ever. It compiles and works as intended (not complete), but I want to see what I'm doing right and wrong as a first-timer.
...
3
votes
1answer
770 views
Best way to make parser code more readable and efficient?
I am optimizing the variable parser for my programming language, and also trying to make it more readable and concise (precedence: readabl e& concise > efficient). What is the best way to improve ...
3
votes
3answers
160 views
CSV reader (revised)
This is the successor of my previous CSV reader. I implemented quite some useful suggestions.
I will give explanation on a few parts:
Prefixing constant identifiers with ...
3
votes
2answers
169 views
Text parser code elegance
I have a text parser that reads certain information from a given file with a specified format. The text file contains some measured properties of a product. The date model number/lot number is written ...
3
votes
1answer
93 views
Which approach is preferable string parsing?
I want to find total word count in string. I have two methods as mentioned below.
...
3
votes
1answer
166 views
Math Equation as String to Reverse Polish Notation Parser
What I have done is create a console program where users type in a math equation such as 5+4-6 or (5+16(8-4))/16 that follows ...
3
votes
1answer
163 views
How to make this BigRational parsing method more efficient?
I'm using the BigRational beta off the BCL CodePlex (bcl.codeplex.com), and I realized it had no parsing method. So I tried to write one. However, it's quite inefficient (5.5ms for a 254 character ...
3
votes
1answer
80 views
C# expression evaluator review request
I successfully created an expression evaluator in C#, and I would like to know if it works well, and what I can do to improve it.
...
2
votes
5answers
293 views
CSV reader and parser
I have implemented a CSV reader. I think I did pretty well. Since CSV is a loosely defined format to begin with I decided to allow some malformations, like anything but a delimiter after an enclosed ...
2
votes
3answers
248 views
Best way to improve Compiler Code?
What is the best way to considerably decrease the size of the following code without sacrificing functionality, and to make it more readable, and well, make it look professional?
...
2
votes
4answers
217 views
Speedily Read and Parse Data
As of now, I am using this code to open a file and read it into a list and parse that list into a string[]:
...
2
votes
1answer
108 views
Parsing a text file containing device information
After trying a couple of parsers, such as Log Parser 2.2, I ended up writing a small utility that supposedly parses the following information onto an object:
(from DirectX Caps Viewer, truncated)
...
2
votes
1answer
287 views
XML to Windows.Forms.Keys List
It took me a lot of poking around and unit testing to get the code to look like it is right now. So I have a XML file which in part looks like this
...
2
votes
1answer
3k views
Query String Serializer
I have a ASP.NET Web Forms project, and I want to build calls to .aspx pages in a strongly-typed fashion. I ended up rolling my own serializer that takes simple structs and saves them to/loads them ...
1
vote
3answers
307 views
Critique my parsing library interface
Update: I've realized that I've missed the goal of fluency completely. I have added another configuration interface now, which more closely meets what I originally desired. I've added this. Comments ...
1
vote
2answers
719 views
Messy c# code - can be improved? String Parsing
For various reasons, I'm parsing a string, this code will explain what I'm after:
...
1
vote
1answer
2k views
Parse and extract synonym data from a website
I made a method that finds synonyms to words using thesaurus.com and I'm looking for comments and feedback to it. In what ways can I improve it, both when it comes to speed, security, reliability ...
1
vote
1answer
127 views
Is this a safe way to parse out HTML tag attributes?
I needed a super simple parser to get HTML attributes and their values. I didn’t want to load a big library or anything so I made this.
I realize I am making assumptions here, mainly:
Attribute ...
1
vote
1answer
46 views
Making an email text-parser generic using PredicateBuilder
I have some code that reads an email from a text file, parses the text, removes some lines (the 'cc' and 'to' lines) and then finds the line numbers of various phrases (e.g. "Regards", "Thanks") and ...
1
vote
0answers
95 views
Interpolating code delimited with character that can appear in code
I've got a string that consists of an arbitrary combination of text and {} delimited python code, for instance, ...