Skip to content

Instantly share code, notes, and snippets.

@augustt198
Last active August 29, 2015 14:05
Show Gist options
  • Save augustt198/889cc9c7580cb6e08ea3 to your computer and use it in GitHub Desktop.
Save augustt198/889cc9c7580cb6e08ea3 to your computer and use it in GitHub Desktop.
int charIndex // Store the current character position
String input // Store the input string
method main(String input)
this.input = input
this.charIndex = 0
parse() // Parsing entry-point
method parse()
while (character = getChar()) != "EOF" // Loop until "EOF" is reached
if character == "<"
String name
method nextWord() // Gets one word (only alphanumeric characters)
String string = ""
while true
char c = getChar()
if isLetter(c) or isDigit(c)
string += c
else
break
return string
method getChar()
if charIndex > input.length
return "EOF" // return "EOF" - stands for "end of file"
else
char c = input.characterAt(input)
charIndex++
return c
class HTMLNode ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment