Last active
August 29, 2015 14:05
-
-
Save augustt198/889cc9c7580cb6e08ea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTMLNode -> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment