Parser needed.

Skybuck Flying skybuck2000 at hotmail.com
Mon Jun 1 22:02:14 EDT 2015


I am trying to rush it a bit but things are starting to go to hell.

SikuliX needs to be restarted continously to deal with bugs.

Plus Eclipse breakpoints cannot be set.

So both IDEs totally suck for any complex code development.

Plus I can already tell this is going to be insanely slow in python for some 
reason.

I am starting to have serious doubts for python as a parser platform:

This simple piece of code already takes 10 seconds for just 120 characters ? 
HOLYSHIT ?!

Bad sign.

BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic 
Studios\\Star Trek Online\\Live\\demos"
BotDemoFile = "SpaceFleetAlertEnemyExample.demo"


import time

def ParseDemoLines( ParaLines ):
print "Parsing " + str( len(ParaLines) ) + " lines."

for LineIndex in range(0, len(ParaLines)):
  if "{" in ParaLines[LineIndex]: # how to process a line.. hmmm...
   print "yup"
return

def ParseStructureOpen( ParaChars, CharIndex ):
# find eol before it and re-read characters until eol this is the structure 
name
while (CharIndex >= 0) and (CharIndex < len(ParaChars)) and 
(ParaChars[CharIndex] <> "\n"):
  print "CharIndex: " + str(CharIndex)
  CharIndex = CharIndex - 1


# re-read characters for structure name
StructureName = ""
while (CharIndex < len(ParaChars)) and (ParaChars[CharIndex] <> "\n"):
  print "CharIndex: " + str(CharIndex)
  StructureName = StructureName + ParaChars[CharIndex]
  CharIndex = CharIndex + 1

print StructureName
return

def ParseStructureClose( ParaChars, CharIndex ):
pass
return

def ParseDemoChars( ParaChars ):
print "Parsing " + str( len(ParaChars) ) + " chars."
for CharIndex in range(0, len(ParaChars)):
  print "Parsing char index: " + str(CharIndex)
  if ParaChars[CharIndex] == "{":
   ParseStructureOpen( ParaChars, CharIndex )
  elif ParaChars[CharIndex] == "}":
   ParseStructureClose( ParaChars, CharIndex )
return

def Main():
DemoFilePath = BotDemoFolder + "\\" + BotDemoFile

FileObject = open( DemoFilePath, "r")

# DemoLines = FileObject.readlines()
# ParseDemoLines( DemoLines )

DemoChars = FileObject.read()
ParseDemoChars( DemoChars )

FileObject.close()
return

print "program started"

Tick1 = time.time()
Main()
Tick2 = time.time()

Seconds = Tick2 - Tick1

print "Time in seconds: " + str(Seconds)

print "program finished"


Bye,
  Skybuck. 




More information about the Python-list mailing list