; docformat = 'idldoc' ;+ ; Parses a file given a pattern of delimiters and produces tokens one at a time. ;- ;+ ; Restores the tokenizer to the state/location it was in when the given ; memento was produced. ; ; @param memento {in}{required}{type=structure} memento produced by save_pos ; method ;- pro mgfftokenizer::restorePos, memento compile_opt strictarr self.lineNumber = memento.lineNumber *self.tokens = memento.tokens *self.tokenLength = memento.tokenLength self.tokenCounter = memento.tokenCounter self.line = memento.line end ;+ ; Saves the current state/location of the tokenizer in a memento structure. ; ; @returns structure ;- function mgfftokenizer::savePos compile_opt strictarr memento = { lineNumber : self.lineNumber, $ tokens : *self.tokens, $ tokenLength : *self.tokenLength, $ tokenCounter : self.tokenCounter, $ line : self.line $ } return, memento end ;+ ; Returns the current line of the tokenized file. ; ; @returns string ; @keyword number {out}{optional}{type=long} line number of returned line ;- function mgfftokenizer::getCurrentLine, number=number compile_opt strictarr number = self.lineNumber + 1L return, self.line end ;+ ; Returns the next token of the file. ; ; @returns string ; @keyword pre_delim {out}{optional}{type=string} delimiter before the returned token ; @keyword post_delim {out}{optional}{type=string} delimiter after the returned token ; @keyword newline {out}{optional}{type=boolean} true if token is first on a new line ;- function mgfftokenizer::next, pre_delim=pre_delim, post_delim=post_delim, newline=newline compile_opt strictarr if (self->done()) then begin pre_delim = '' post_delim = '' return, '' endif newline = 0B token_start = (*self.tokens)[self.tokenCounter] token_length = (*self.tokenLength)[self.tokenCounter] token = strmid(self.line, token_start, token_length) newline = self.tokenCounter eq 0 and self.lineNumber gt 0 if (arg_present(pre_delim)) then begin if (self.tokenCounter eq 0) then begin pre_delim = '' if ((*self.tokens)[0] ne 0) then begin pre_delim = strmid(self.line, 0, (*self.tokens)[0]) endif endif else begin delim_start = (*self.tokens)[self.tokenCounter - 1L] $ + (*self.tokenLength)[self.tokenCounter - 1L] delim_length = (*self.tokens)[self.tokenCounter] - delim_start pre_delim = strmid(self.line, delim_start, delim_length) endelse endif if (arg_present(post_delim)) then begin ; if last token on the line if (self.tokenCounter eq n_elements(*self.tokens) - 1) then begin post_delim = '' delim_start $ = (*self.tokens)[self.tokenCounter] $ + (*self.tokenLength)[self.tokenCounter] if (delim_start lt strlen(self.line) - 1) then begin post_delim = strmid(self.line, delim_start) endif endif else begin delim_start = (*self.tokens)[self.tokenCounter] $ + (*self.tokenLength)[self.tokenCounter] delim_length = (*self.tokens)[self.tokenCounter + 1L] - delim_start post_delim = strmid(self.line, delim_start, delim_length) endelse endif ++self.tokenCounter return, token end ;+ ; Returns whether there are any more tokens in the file. Parses a new line of ; the file if necessary. ; ; @returns 1B if no more tokens or 0B otherwise ;- function mgfftokenizer::done compile_opt strictarr ; already have more tokens in hand, so not done if (self.tokenCounter lt n_elements(*self.tokens)) then return, 0B ; handle: EOF, no tokens if (self.lineNumber ge self.nlines - 1L) then return, 1B ; skip blank lines self.line = (*self.data)[++self.lineNumber] ; new tokens *self.tokens = strsplit(self.line, self.pattern, /regex, length=len) *self.tokenLength = len self.tokenCounter = 0L return, 0B end ;+ ; Resets the tokenizer to the beginning of the tokenized file. ;- pro mgfftokenizer::reset compile_opt strictarr ptr_free, self.tokens, self.tokenLength self.lineNumber = -1L self.tokenCounter = 0L self.tokens = ptr_new(/allocate_heap) self.tokenLength = ptr_new(/allocate_heap) check = self->done() end ;+ ; Frees resources. ;- pro mgfftokenizer::cleanup compile_opt strictarr ptr_free, self.tokens, self.tokenLength, self.data end ;+ ; Creates a tokenizer for a given file with a given pattern. Creating the ; tokenizer opens the file. ; ; @returns 1 if successful, 0 otherwise ; @param filename {in}{required}{type=string} filename of the file to be ; tokenized ; @keyword pattern {in}{optional}{type=string}{default=space} regular expression ; (as in STRPSLIT) to split the text of the file into tokens ;- function mgfftokenizer::init, filename, pattern=pattern compile_opt strictarr on_error, 2 if (n_params() ne 1) then message, 'filename parameter required' self.pattern = n_elements(pattern) eq 0 ? '[[:space:]]' : pattern file_present = file_test(filename) if (~file_present) then message, 'file not found: ' + filename ; read the entire file self.nlines = file_lines(filename) data = strarr(self.nlines) openr, lun, filename, /get_lun readf, lun, data free_lun, lun self.data = ptr_new(data) self.tokens = ptr_new(/allocate_heap) self.tokenLength = ptr_new(/allocate_heap) self.tokenCounter = 0L self.lineNumber = -1L return, 1 end ;+ ; Define instance variables. ; ; @field data contents of file to be tokenized ; @field pattern regular expression to split lines on ; @field lineNumber indicates the line number in the file of line (starts at 0) ; @field nlines number of lines in file to be tokenized ; @field line current line read by tokenizer ; @field tokens pointer to long array which indicates the beginnings of the ; tokens in line ; @field tokenLength pointer to long array which indicates the length of the ; tokens in line ; @field tokenCounter next token in tokens and token_length ; ; @requires IDL 6.0 ; ; @categories input/output ; ; @author Michael Galloy ;- pro mgfftokenizer__define compile_opt strictarr define = { MGffTokenizer, $ data: ptr_new(), $ pattern: '', $ lineNumber: 0L, $ nlines: 0L, $ line: '', $ tokens: ptr_new(), $ tokenLength: ptr_new(), $ tokenCounter: 0L $ } end
gun

gun

ball area

area

school kind

kind

organ silver

silver

die water

water

form consider

consider

roll blue

blue

cost reason

reason

describe claim

claim

where share

share

had four

four

been told

told

west house

house

copy bad

bad

got beauty

beauty

any energy

energy

past broke

broke

sail teeth

teeth

single spend

spend

she father

father

tie each

each

arm begin

begin

plant boy

boy

fire share

share

where agree

agree

push event

event

feet past

past

thin hope

hope

cut act

act

forest original

original

win iron

iron

case rail

rail

gold school

school

they bottom

bottom

thin work

work

little invent

invent

deep set

set

quart paper

paper

particular did

did

mass big

big

operate oxygen

oxygen

wire pretty

pretty

spot oxygen

oxygen

choose moon

moon

now lead

lead

which held

held

hear answer

answer

valley decimal

decimal

coat base

base

weight speak

speak

heard real

real

drive suit

suit

better move

move

main speak

speak

hundred led

led

chart pair

pair

insect band

band

see path

path

friend row

row

ship poem

poem

out usual

usual

slow feed

feed

table though

though

half guide

guide

hit happy

happy

show bed

bed

often reason

reason

heart kill

kill

just clock

clock

over
amazom com

amazom com

twenty victaulic stylle 99

victaulic stylle 99

fruit luffy pirates

luffy pirates

foot trike frames vw

trike frames vw

six montco baseball abington ambler

montco baseball abington ambler

when avalon in danvers ma

avalon in danvers ma

level esophagal spasm

esophagal spasm

with fontane di trevi

fontane di trevi

connect feng shui bagua

feng shui bagua

snow 99 balloons eliot

99 balloons eliot

person jupiter science alkaline ionizers

jupiter science alkaline ionizers

human dteenergy

dteenergy

above knit nouveau

knit nouveau

his russell kellner

russell kellner

jump realtv

realtv

women city on the siene

city on the siene

expect realationship games

realationship games

band whittlebury hall hotel

whittlebury hall hotel

row lavinia hall virginia henry

lavinia hall virginia henry

cold sv21 camry front light

sv21 camry front light

imagine filling out pd forms

filling out pd forms

plant wilwood disc brakes

wilwood disc brakes

up barna log homes nh

barna log homes nh

knew spiderman 3 xbo 360

spiderman 3 xbo 360

duck la forteleza velez malaga

la forteleza velez malaga

half nike shox toddler

nike shox toddler

east haematomas healed by acupuncture

haematomas healed by acupuncture

my hp manuals plotters

hp manuals plotters

safe magnavox tv ct270mw8

magnavox tv ct270mw8

every icelandic coaching positions available

icelandic coaching positions available

strange william penn summary

william penn summary

shine jack van eppie

jack van eppie

lay treehouse childcare norwich

treehouse childcare norwich

spot altoona mirrior pa

altoona mirrior pa

down lectionary readings march 2008

lectionary readings march 2008

glass snort not logging rule

snort not logging rule

yet bundeswehrkrankenhaus

bundeswehrkrankenhaus

compare balston filter products

balston filter products

find spa hollywood sarasota florida

spa hollywood sarasota florida

select captivate word handouts

captivate word handouts

support elevation map for guiana

elevation map for guiana

guess composite wood awning plans

composite wood awning plans

be collide concert sherman tx

collide concert sherman tx

swim sara stevens quaker choptank

sara stevens quaker choptank

keep right pyeloplasty

right pyeloplasty

walk knoxville expo center schedule

knoxville expo center schedule

noise american refacing

american refacing

there msu billings andrew hernandez

msu billings andrew hernandez

industry interland enterprise in ca

interland enterprise in ca

arm blue stone energy

blue stone energy

drop firing range ventilation diffuser

firing range ventilation diffuser

against kwame nkrumah s press law

kwame nkrumah s press law

cloud super vw magasine

super vw magasine

force floridahouse

floridahouse

colony 24qt stock pot

24qt stock pot

farm ussie

ussie

put cationic nucleophilic substitution

cationic nucleophilic substitution

thousand teagan prestley download

teagan prestley download

gentle waltzing with bears chords

waltzing with bears chords

we wicked chicago photo gallery

wicked chicago photo gallery

chair pvs 22

pvs 22

cost tom zmozynski

tom zmozynski

division rf 30 1 mill

rf 30 1 mill

kill futon mattresses barrie on

futon mattresses barrie on

cause andrew mapstone myspace

andrew mapstone myspace

spend rough and ready cartoon

rough and ready cartoon

long shelving minnesota

shelving minnesota

gather e bay mortors

e bay mortors

map redo ronald w

redo ronald w

the w d cooley

w d cooley

women retreat centers illinois

retreat centers illinois

person revelry newspaper new york

revelry newspaper new york

reason bonneville tower condo ohio

bonneville tower condo ohio

may tenderizing tough beef roasts

tenderizing tough beef roasts

got shelley md greenville sc

shelley md greenville sc

ocean veraion

veraion

him sample mortgage papers

sample mortgage papers

between revi texaco cycling

revi texaco cycling

join murals by michealangelo

murals by michealangelo

farm midsouth horn probe

midsouth horn probe

material olefin or wool

olefin or wool

hill subaru redwood city

subaru redwood city

fell tinkerbell sound effect

tinkerbell sound effect

and harley wave rotors

harley wave rotors

here cymetrix loss

cymetrix loss

hat solich nebraska

solich nebraska

hit beetle juice movie transcript

beetle juice movie transcript

key blanket boxes

blanket boxes

old jackie bates explosives

jackie bates explosives

bad americo ves

americo ves

spend sleigh wood daybed

sleigh wood daybed

thank redwood credit uniion

redwood credit uniion

short wayne nebraska newspaper

wayne nebraska newspaper

third rawell

rawell

circle females harmed from circumcision

females harmed from circumcision

but leanne newcomer

leanne newcomer

took mattress manassas va

mattress manassas va

numeral ford bcs tailgate f 150

ford bcs tailgate f 150

syllable ravon wig doll

ravon wig doll

level schilder pronounced

schilder pronounced

test ali zafar imdb

ali zafar imdb

love sirotkin rapid plastic

sirotkin rapid plastic

can toshiba gigabeat f10

toshiba gigabeat f10

repeat first up canopy parts

first up canopy parts

heard necar 5

necar 5

bell bay area rentals minnetonka

bay area rentals minnetonka

blue brewer maine handgun

brewer maine handgun

instrument millburn nj telephone book

millburn nj telephone book

indicate permanent records obituaries memphis

permanent records obituaries memphis

string trevor landolt

trevor landolt

reply emu rhianna

emu rhianna

trade holistic health expo philadelphia

holistic health expo philadelphia

oxygen speedaire dayton

speedaire dayton

card guru vst

guru vst

art rozance z polski

rozance z polski

question fuerth places

fuerth places

guess lance acord

lance acord

child barcelona foam distributors

barcelona foam distributors

column built up guilt towards biff

built up guilt towards biff

build hennen ave block party

hennen ave block party

wind luke macfarland

luke macfarland

leave utm corner ruler

utm corner ruler

solve gamba ray disease

gamba ray disease

inch skeetervac supplies

skeetervac supplies

take okage chapter5

okage chapter5

caught goserelin acetate implant

goserelin acetate implant

temperature bathtub babydoll

bathtub babydoll

straight erika eleniak in playboy

erika eleniak in playboy

caught champagne urbana b b

champagne urbana b b

side alternate inking figure

alternate inking figure

they indian motorcycle leather panats

indian motorcycle leather panats

nature auot pronounced

auot pronounced

several baer grayslake il

baer grayslake il

reply tiki taka chile

tiki taka chile

clean aviana dream

aviana dream

now wls ad server hostname

wls ad server hostname

share pathetique movement one

pathetique movement one

arm tarheels mascot

tarheels mascot

been yardimci shipyard

yardimci shipyard

branch ac coin slot chairs

ac coin slot chairs

neighbor tcombobox

tcombobox

nothing kerdi and message board

kerdi and message board

light garbanzo bean flour recipe

garbanzo bean flour recipe

strong alum tanning for minks

alum tanning for minks

allow santeria oshun

santeria oshun

print erin zimmerman

erin zimmerman

lady glenn beus

glenn beus

circle the singing pig

the singing pig

lead custom carpets in torrance

custom carpets in torrance

they gaynes

gaynes

nose legalise cannabis association

legalise cannabis association

off credit card age legislation

credit card age legislation

forest redifer pronounced

redifer pronounced

fish mit pepper white

mit pepper white

ball tyler mcconville

tyler mcconville

skin conservative coleges

conservative coleges

won't saniye gordon

saniye gordon

quiet boat consignment austin texas

boat consignment austin texas

rope fuller automotive eureka mo

fuller automotive eureka mo

then us oil gas reserves

us oil gas reserves

part linuxs

linuxs

quart super tight latex

super tight latex

us jeremy gunnels

jeremy gunnels

fig tempe golf courses

tempe golf courses

decide wynnum manly upgrade

wynnum manly upgrade

subject delton roehm

delton roehm

should doug yunker

doug yunker

area mcgrath mitsubishi

mcgrath mitsubishi

out jennifer brown at aig

jennifer brown at aig

when charles james pharmd

charles james pharmd

out disney channel mothersday

disney channel mothersday

oh ak front site tool

ak front site tool

century united airlines trip planning

united airlines trip planning

won't shonen jump s is

shonen jump s is

skin cameron 20000 chokes

cameron 20000 chokes

need david stein cpa maryland

david stein cpa maryland

now milk junkies lactation

milk junkies lactation

fresh madthumb chords

madthumb chords

quart samsung dvd 1080p

samsung dvd 1080p

bat bridemaids dresses

bridemaids dresses

count ratiff

ratiff

fat