node/lib/metasm/metasm/preprocessor.rb
def readop(lexer)
			if not tok = lexer.readtok or tok.type != :punct
				lexer.unreadtok tok
				return
			end

			op = tok
			case op.raw
			# may be followed by itself or '='
			when '>', '<'
				if ntok = lexer.readtok and ntok.type == :punct and (ntok.raw == op.raw or ntok.raw == '=')
					op = op.dup
					op.raw << ntok.raw
				else
					lexer.unreadtok ntok
				end
			# may be followed by itself
			when '|', '&'
				if ntok = lexer.readtok and ntok.type == :punct and ntok.raw == op.raw
					op = op.dup
					op.raw << ntok.raw
				else
					lexer.unreadtok ntok
				end
			# must be followed by '='
			when '!', '='
				if not ntok = lexer.readtok or ntok.type != :punct and ntok.raw != '='
					lexer.unreadtok ntok
					lexer.unreadtok tok
					return
				end
				op = op.dup
				op.raw << ntok.raw
			# ok
			when '^', '+', '-', '*', '/', '%', '>>', '<<', '>=', '<=', '||', '&&', '!=', '=='
			# unknown
			else
				lexer.unreadtok tok
				return
			end
			op.value = op.raw.to_sym
			op
		end
# reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer returns the corresponding symbol or nil
def readop(lexer)
			if not tok = lexer.readtok or tok.type != :punct
				lexer.unreadtok tok
				return
			end
			op = tok
			case op.raw
			when '>', '<'
				if ntok = lexer.readtok and ntok.type == :punct and (ntok.raw == op.raw or ntok.raw == '=')
					op = op.dup
					op.raw << ntok.raw
				else
					lexer.unreadtok ntok
				end
			when '|', '&'
				if ntok = lexer.readtok and ntok.type == :punct and ntok.raw == op.raw
					op = op.dup
					op.raw << ntok.raw
				else
					lexer.unreadtok ntok
				end
			when '!', '='
				if not ntok = lexer.readtok or ntok.type != :punct and ntok.raw != '='
					lexer.unreadtok ntok
					lexer.unreadtok tok
					return
				end
				op = op.dup
				op.raw << ntok.raw
			when '^', '+', '-', '*', '/', '%', '>>', '<<', '>=', '<=', '||', '&&', '!=', '=='
			else
				lexer.unreadtok tok
				return
			end
			op.value = op.raw.to_sym
			op
		end
def readop ( lexer ) if not tok = lexer . readtok or tok . type != :punct lexer . unreadtok tok return end op = tok case op . raw when '>' , '<' if ntok = lexer . readtok and ntok . type == :punct and ( ntok . raw == op . raw or ntok . raw == '=' ) op = op . dup op . raw << ntok . raw else lexer . unreadtok ntok end when '|' , '&' if ntok = lexer . readtok and ntok . type == :punct and ntok . raw == op . raw op = op . dup op . raw << ntok . raw else lexer . unreadtok ntok end when '!' , '=' if not ntok = lexer . readtok or ntok . type != :punct and ntok . raw != '=' lexer . unreadtok ntok lexer . unreadtok tok return end op = op . dup op . raw << ntok . raw when '^' , '+' , '-' , '*' , '/' , '%' , '>>' , '<<' , '>=' , '<=' , '||' , '&&' , '!=' , '==' else lexer . unreadtok tok return end op . value = op . raw . to_sym op end
reads an operator from the lexer, returns the corresponding symbol or nil
reads an operator from the lexer returns the corresponding symbol or nil
# may be followed by itself or '=' # may be followed by itself # must be followed by '=' # ok # unknown
lexer