- switch c = txt.charAt(cur++)
- when '!'
- tok_state = tok_state_markup_declaration_open
- when '/'
- tok_state = tok_state_end_tag_open
- when '?'
- parse_error()
- tok_cur_tag = new_comment_token '?'
- tok_state = tok_state_bogus_comment
- else
- if is_lc_alpha(c)
- tok_cur_tag = new_open_tag c
- tok_state = tok_state_tag_name
- else if is_uc_alpha(c)
- tok_cur_tag = new_open_tag c.toLowerCase()
- tok_state = tok_state_tag_name
- else
- parse_error()
- tok_state = tok_state_data
- cur -= 1 # we didn't parse/handle the char after <
- return new_text_node '<'
- return null
+ c = txt.charAt(cur++)
+ if c is '!'
+ tok_state = tok_state_markup_declaration_open
+ return
+ if c is '/'
+ tok_state = tok_state_end_tag_open
+ return
+ if is_uc_alpha(c)
+ tok_cur_tag = new_open_tag c.toLowerCase()
+ tok_state = tok_state_tag_name
+ return
+ if is_lc_alpha(c)
+ tok_cur_tag = new_open_tag c
+ tok_state = tok_state_tag_name
+ return
+ if c is '?'
+ parse_error()
+ tok_cur_tag = new_comment_token '?' # FIXME right?
+ tok_state = tok_state_bogus_comment
+ return
+ # Anything else
+ parse_error()
+ tok_state = tok_state_data
+ cur -= 1 # we didn't parse/handle the char after <
+ return new_text_node '<'