parsing text
#1
Posted 27 February 2011 - 11:18 PM
i was jus wondering if i should use boost regexp to ease my parsing of the bsp entities text
i think in quake3 they are just using regular c string functions to parse this
but that is just simply way too much code
and could be done way faster with reg exp help
but installing boost c++ libs to get reg exp is like 240mb
why is boost asking for that much room?
how should i parse this?
#2
Posted 27 February 2011 - 11:41 PM
#3
Posted 28 February 2011 - 12:46 AM
{
"name" "value"
"name2" "value2"
}
so w preg_match i would just do
entities[] = preg_match(/{.*?}/)
entities[i].lines[] = explode(entities[i], "\n")
preg_match(/(\".*?\")\s+?(\".*?\")/, entities[i].lines[i], entities[i].nameandvaluearray)
#4
Posted 28 February 2011 - 02:45 AM
#5
Posted 28 February 2011 - 05:45 AM
its just that quake source is using only using c string function and logic i guess
so i thot it be way less code to do it with regex
#6
Posted 28 February 2011 - 06:22 AM
#7
Posted 28 February 2011 - 11:04 AM
-
Currently working on: the 3D engine for Tomb Raider.
#8
Posted 28 February 2011 - 11:09 AM
and no i dont need error detection
the less code the better
ill add that stuff later
#9
Posted 28 February 2011 - 11:28 AM
#10
Posted 28 February 2011 - 01:32 PM
My plan to make things simpler is to do a precompile to reduce everything in the typed code to simple 2 variable + one operator instructions, then interpreting after that will be really simple.
Just like .oisyn says, little more than scanf is all you need. :)
#11
Posted 01 March 2011 - 02:09 AM
this is a perfect place to use it and i would like to have it anyways
i also mad at c++ strings because i cant printf them
it tells me that printf is expecting a string and my string is an int, wtfff
so i tried converting string to char and it wont let me do that either
what is wrong with u c++ lol
c++ is acting like c--
maybe even an f+
#12
Posted 01 March 2011 - 05:10 AM
By the way, C-- is an actual language, although one designed more as an intermediate language for compilers than a language for humans.
#13
Posted 01 March 2011 - 07:23 AM
enjoycrf said:
In C++, you shouldn't even use the C I/O functions, but the STL counterpart, like 'cout << str;'. See here for more info, and here for why you should avoid printf and the likes.
enjoycrf said:
#14
Posted 01 March 2011 - 08:29 AM
hmm this looks very familiar
lets try this again
#15
Posted 01 March 2011 - 08:37 AM
could that possibly be windows code?
i migrated from windows
plus i get code from dif sources
#16
Posted 01 March 2011 - 08:40 AM
wow i am a total nuub
i guess i just found that i am doing c style file handling too?
#include <fstream> // Include this to use ifstream
#include <vector> // Include this to use STL vectors
#17
Posted 01 March 2011 - 08:41 AM
-
Currently working on: the 3D engine for Tomb Raider.
#18
Posted 01 March 2011 - 08:50 AM
g++ %f -o nice -lGLU -lGL -lglut -lfmodex -std=c++0x
slim, mean and lean cuisine lol
let me kno if theres something beter or i should be using
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


This topic is locked









