node/lib/metasm/metasm/parse_c.rb
def readop(parser)
			if not op = parser.skipspaces or op.type != :punct
				parser.unreadtok op
				return
			end

			case op.raw
			when '>', '<', '|', '&' # << >> || &&
				if ntok = parser.readtok and ntok.type == :punct and ntok.raw == op.raw
					op.raw << ntok.raw
				else
					parser.unreadtok ntok
				end
			when '!' # != (mandatory)
				if not ntok = parser.readtok or ntok.type != :punct and ntok.raw != '='
					parser.unreadtok op
					return
				end
				op.raw << ntok.raw
			when '+', '-', '*', '/', '%', '^', '=', ',', '?', ':', '>>', '<<', '||', '&&',
			     '+=','-=','*=','/=','%=','^=','==','&=','|=','!=' # ok
			else # bad
				parser.unreadtok op
				return
			end

			# may be followed by '='
			case op.raw
			when '+', '-', '*', '/', '%', '^', '&', '|', '>>', '<<', '<', '>', '='
				if ntok = parser.readtok and ntok.type == :punct and ntok.raw == '='
					op.raw << ntok.raw
				else
					parser.unreadtok ntok
				end
			end

			op.value = op.raw.to_sym
			op
		end
# reads a binary operator from the parser, returns the corresponding symbol or nil
reads a binary operator from the parser, returns the corresponding symbol or nil
reads a binary operator from the parser returns the corresponding symbol or nil
def readop(parser)
			if not op = parser.skipspaces or op.type != :punct
				parser.unreadtok op
				return
			end
			case op.raw
			when '>', '<', '|', '&' 
				if ntok = parser.readtok and ntok.type == :punct and ntok.raw == op.raw
					op.raw << ntok.raw
				else
					parser.unreadtok ntok
				end
			when '!' 
				if not ntok = parser.readtok or ntok.type != :punct and ntok.raw != '='
					parser.unreadtok op
					return
				end
				op.raw << ntok.raw
			when '+', '-', '*', '/', '%', '^', '=', ',', '?', ':', '>>', '<<', '||', '&&',
			     '+=','-=','*=','/=','%=','^=','==','&=','|=','!=' 
			else 
				parser.unreadtok op
				return
			end
			case op.raw
			when '+', '-', '*', '/', '%', '^', '&', '|', '>>', '<<', '<', '>', '='
				if ntok = parser.readtok and ntok.type == :punct and ntok.raw == '='
					op.raw << ntok.raw
				else
					parser.unreadtok ntok
				end
			end
			op.value = op.raw.to_sym
			op
		end
def readop ( parser ) if not op = parser . skipspaces or op . type != :punct parser . unreadtok op return end case op . raw when '>' , '<' , '|' , '&' if ntok = parser . readtok and ntok . type == :punct and ntok . raw == op . raw op . raw << ntok . raw else parser . unreadtok ntok end when '!' if not ntok = parser . readtok or ntok . type != :punct and ntok . raw != '=' parser . unreadtok op return end op . raw << ntok . raw when '+' , '-' , '*' , '/' , '%' , '^' , '=' , ',' , '?' , ':' , '>>' , '<<' , '||' , '&&' , '+=' , '-=' , '*=' , '/=' , '%=' , '^=' , '==' , '&=' , '|=' , '!=' else parser . unreadtok op return end case op . raw when '+' , '-' , '*' , '/' , '%' , '^' , '&' , '|' , '>>' , '<<' , '<' , '>' , '=' if ntok = parser . readtok and ntok . type == :punct and ntok . raw == '=' op . raw << ntok . raw else parser . unreadtok ntok end end op . value = op . raw . to_sym op end
reads a binary operator from the parser, returns the corresponding symbol or nil
reads a binary operator from the parser returns the corresponding symbol or nil
# << >> || && # != (mandatory) # ok # bad # may be followed by '='
parser