Showing preview only (1,018K chars total). Download the full file or copy to clipboard to get everything.
Repository: yberreby/rgo
Branch: master
Commit: 06295d288670
Files: 28
Total size: 989.0 KB
Directory structure:
gitextract_6x5ebcjo/
├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── Cargo.toml
├── README.md
├── benches/
│ └── parse.rs
├── misc/
│ ├── log.md
│ └── selector-inconsistency.md
├── src/
│ ├── ast/
│ │ ├── expressions.rs
│ │ ├── mod.rs
│ │ ├── statements.rs
│ │ └── types.rs
│ ├── lexer/
│ │ ├── mod.rs
│ │ └── test.rs
│ ├── lib.rs
│ ├── main.rs
│ ├── parser/
│ │ ├── error.rs
│ │ ├── mod.rs
│ │ └── test.rs
│ ├── pos.rs
│ └── token.rs
└── tests/
├── data/
│ └── pass/
│ ├── arithConst_ssa.go
│ ├── hello.go
│ ├── precedence.go
│ ├── rewriteAMD64.go
│ ├── simplest.go
│ └── viper.go
└── runner.rs
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
target
callgrind.out.*
/tmp
================================================
FILE: .travis.yml
================================================
language: rust
rust:
- nightly
- beta
- stable
notifications:
email: false
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing
You can find sections of the code in need of attention by exploring GitHub
issues, and/or with the help of grep:
``` shell
$ grep -RE 'XXX|TODO|FIXME|unimplemented' src
```
Contributions are encouraged, but to maintain a high level of quality, we ask
that you follow the guidelines laid out in this document.
## Guidelines
**Run tests** with `cargo test` after your committing your changes.
We use [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt) to maintain a
consistent style throughout the project. Please run the latest version of
`rustfmt` on your code before submitting a PR.
Put tests for a module in a separate file named `test.rs`, and import them like
so from the module you want to test:
```rust
#[cfg(test)]
mod test;
```
Rebase your changes on top of `origin/master` before submitting a PR, to keep
your branch up-to-date.
When in doubt, [refer to the Go spec](https://golang.org/ref/spec).
### Git Best Practices
We want to keep the git history as clean as possible.
If you need to make changes to a Pull Request after submitting it, please
include them in your previous commit(s) and force-push instead of adding new
commits. You can do so by staging your changes and running `git commit --amend`.
If the `master` branch is updated while your PR is open, **do not merge it** into
your feature branch. Instead, rebase your branch on top of `origin/master` and
force-push to your fork.
Where possible, please avoid mixing up many unrelated changes in single PR;
prefer making several smaller PRs instead. If you have to change many things in
a single PR, try to separate them into semantically meaningul commits. This is
not a hard rule, but it is preferred.
================================================
FILE: Cargo.toml
================================================
[package]
authors = ["Yohai Berreby (yberreby) <yohaiberreby@gmail.com>"]
description = "A work-in-progress Go compiler toolchain."
license = "MIT/Apache-2.0"
name = "rgo"
repository = "https://github.com/yberreby/rgo"
version = "0.1.0"
[dependencies]
convenience = "0.1.0"
env_logger = "0.3.3"
lazy_static = "0.2.0"
log = "0.3.6"
num = "0.1"
quick-error = "1.0.0"
time = "0.1.35"
[dependencies.clippy]
optional = true
version = "0.0.63"
[dev-dependencies]
colored = "1.2.0"
convenience = "0.1.0"
[features]
default = []
[profile]
[profile.dev]
debug = true
[profile.release]
debug = true
[[test]]
harness = false
name = "runner"
[[bin]]
name = "rgo"
doc = false
path = "src/main.rs"
================================================
FILE: README.md
================================================
# rgo (stalled) [](https://travis-ci.org/yberreby/rgo)
`rgo` was a work-in-progress Go compiler, written in Rust.
This was primarily a fun learning project.
I chose Go as the source language because C compilers have been written over and
over, and I wanted to do something new. Go's spec is pretty simple, so it seemed
like a good choice. The fact that is has a GC also made implementing a compiler
for it more challenging and, therefore, more interesting.
Additionally, Go's reference implementation uses a custom backend for
optimization and codegen, while `rgo` was to use LLVM for optimization and machine
code generation.
## License
Copyright (c) 2016 The `rgo` Project Developers.
Licensed under either of
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* [MIT license](http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
================================================
FILE: benches/parse.rs
================================================
#![feature(test)]
/// Utility macro to bench test files one by one.
macro_rules! bench_lex {
($name:ident, $path:expr) => {
#[allow(non_snake_case)]
mod $name {
extern crate convenience;
extern crate test;
extern crate rgo;
use self::test::Bencher;
use std::path::Path;
use std::path::PathBuf;
fn test_path<P: AsRef<Path>>(path: P) -> PathBuf {
let mut new = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
new.push("tests");
new.push("data");
new.push(path.as_ref());
new
}
#[bench]
fn bench_lex(b: &mut Bencher) {
let src = convenience::read_file(test_path($path)).unwrap();
b.bytes = src.len() as u64;
b.iter(|| {
rgo::lexer::tokenize(&src);
});
}
}
}
}
bench_lex!(viper, "pass/viper.go");
bench_lex!(hello, "pass/hello.go");
bench_lex!(arithConst_ssa, "pass/arithConst_ssa.go");
bench_lex!(rewriteAMD64, "pass/rewriteAMD64.go");
================================================
FILE: misc/log.md
================================================
# Log
This is the log file for the `rgo` project. I (@yberreby) write my thoughts down
periodically. I hope this will help understand the history of the project as it
grows and time passes.
## Sun Mar 27 - Starting the journey
I've always wanted to write a compiler or an interpreter - *something* that
takes code and turns it into something runnable.
Lisp has been reimplemented again and again, and was too simple. C compilers are
also commonplace, AND the language is, well, not a joy to work with.
So I chose Go. I dislike many of the language's design choices but it seemed
like a good fit. To my knowledge, there is no reimplementation of the Go
compiler in Rust or similar languages, so I decided to write one.
There's an additional challenge: I know very, very little Go. As of writing,
I've only written a few hundred lines of Go, and found two bugs in the viper
package. So I'm learning more Go by writing a compiler for it :)
I'm starting with parsing. I have received no formal education on compilers, but
as far as I know, the first step toward building a compiler is to parse the
source code into an Abstract Syntax Tree, or AST.
To do that, I'm using the [Go Specification](https://golang.org/ref/spec) to
look up the syntax of various constructs and translating that into a bunch of
Rust structs and enums. This is somewhat tedious, but I'm learning a few things
about Go's syntax along the way.
## Wed Mar 30 19:18 - Thoughts on testing
A *critical* part of a complex system like a compiler is testing, so we'll want
to write a lot of tests to cover as much surface as possible.
There are three main things we want to test:
- lexical analysis
- parsing
- translation
If all three phases works correctly, we have are likely to produce a correct
program.
Now, we would only test the *output* of the program, because in most cases, if
either lexical analysis or parsing produce incorrect results or fail, the output
of the compiled program will be wrong. The advantage of this approach is that
it's easier to write tests for a handful of big, complex programs than for a
myriad of very small programs. The disadvantage is that in case there's a
failure, it's much harder to track it down to the piece of code that is
responsible.
I think it is best to combine the two approaches: integration tests that only
care about the output, and unit tests that care only about a very small part of
the code. Lexing should be very easy to test; parsing, a bit harder, as AFAIK it
requires more context (e.g. `foo` can be a package name, a package alias, a
constant, a function parameter...).
## Thu Mar 31 15:16 - Next steps
The lexer can now tokenize a "Hello, rgo" program properly!
Next steps: integer literals (very easy); semicolon; various compound tokens.
## Sun Apr 3 12:12 - Whitespace
When I started writing the lexer, I've made the decision to tokenize *all*
whitespace, in order to decouple lexing from semicolon insertion. Unfortunately,
this led to an unnecessarily verbose token string (e.g. `PACKAGE, WHITESPACE,
IDENT("main")` - the `WHITESPACE` token is 100% useless AFAICT), as well as the
unability to distinguish insignificant whitespace, such as ten spaces one after
the other, from significant whitespace (newlines).
I've just changed that: insignificant whitespace is now ignored, and contiguous
blocks of significant whitespace are tokenized as a single `WHITESPACE` token.
We'll see how well this works out in practice, but I feel good about this
change.
## Sun Apr 3 15:23 - Done & Next steps
`test-data/viper.go` can now be tokenized without panicking!
Next steps:
In lexer: float, complex/imaginary, raw string and rune literals.
Then, the parser. First goal: parsing a "Hello, rgo" program.
Then write unit tests for various constructs.
Then integration tests using complex source files from big Go projects.
## Sun Apr 10 10:59:15 - Done & Next steps
Package clauses and import declarations can now be parsed. String literal
parsing is _very_ hackish, though: interpreted strings are not actually
interpreted, but treated like raw strings. This is bad.
Added a "progress.md" file that will help me keep track of what I need to do
next.
## Fri Apr 15 13:45 - Progress report and some notes
- we need a _lot_ of tests, that make sure to trigger every corner case under
the sun. A good idea may be to reuse Go's test suite, but I'm not sure how
hard that would be. What _is_ certain is that correctness is a priority.
- the lexer does not handle complex numbers, runes, floats, hexadecimal
integers... but kind-of works for simple programs.
- the parser has been substantially improved but I dislike the complexity of
token pattern matching. Ideally we'd have a nice, float hierachy of tokens,
but then we lose some type safety...
- I still have no idea how I'll go about generating LLVM IR. I'm also not sure
whether the visitor pattern will be useful, and if it is, how to implement it
since my AST is basically a deeply nested hierarchy of structs and enums.
- Writing a compiler is fun! I don't know how far I'll take this, but so far, it
has been an extremely valuable experience. I encourage anyone who's reading
this and still hesitating to try, if only for the experience they will gain.
================================================
FILE: misc/selector-inconsistency.md
================================================
https://play.golang.org/p/Xne3T3CL7d
```go
package main
import (
"go/ast"
"go/parser"
"go/token"
)
func main() {
// src is the input for which we want to print the AST.
src := `
package main
func foo(x (func(a ...interface{}) (n int, err error))) {}
func main() {
println("Hello, World!")
foo(fmt.Println)
}
`
// Create the AST by parsing src.
fset := token.NewFileSet() // positions are relative to fset
f, err := parser.ParseFile(fset, "", src, 0)
if err != nil {
panic(err)
}
// Print the AST.
ast.Print(fset, f)
}
```
Excerpt from the output:
```
1: *ast.ExprStmt {
160 . . . . . . X: *ast.CallExpr {
161 . . . . . . . Fun: *ast.Ident {
162 . . . . . . . . NamePos: 8:2
163 . . . . . . . . Name: "foo"
164 . . . . . . . . Obj: *(obj @ 11)
165 . . . . . . . }
166 . . . . . . . Lparen: 8:5
167 . . . . . . . Args: []ast.Expr (len = 1) {
168 . . . . . . . . 0: *ast.SelectorExpr {
169 . . . . . . . . . X: *ast.Ident {
170 . . . . . . . . . . NamePos: 8:6
171 . . . . . . . . . . Name: "fmt"
172 . . . . . . . . . }
173 . . . . . . . . . Sel: *ast.Ident {
174 . . . . . . . . . . NamePos: 8:10
175 . . . . . . . . . . Name: "Println"
176 . . . . . . . . . }
177 . . . . . . . . }
178 . . . . . . . }
179 . . . . . . . Ellipsis: -
180 . . . . . . . Rparen: 8:17
181 . . . . . . }
182 . . . . . }
```
MethodExpr < SelectorExpr, basically. I thought the Go AST would differentiate
between method expressions (`Type.MethodName`) and selector expressions
(`someExpr.someField`, `foo().bar`...), but it doesn't, because treating them as
the same thing makes compilation easier...
================================================
FILE: src/ast/expressions.rs
================================================
use lexer::TokenKind;
use token::Spanned;
use super::{Arguments, Conversion, Type, Ident, MaybeQualifiedIdent, Literal};
// Expr = UnaryExpr | Expr binary_op Expr .
// UnaryExpr = PrimaryExpr | unary_op UnaryExpr .
//
// binary_op = "||" | "&&" | rel_op | add_op | mul_op .
// rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" .
// add_op = "+" | "-" | "|" | "^" .
// mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .
//
// unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
// I went for a strongly-typed approach here: instead of having one giant, flat `Expr` enum, I
// chose a deeply nested hierarchy.
//
// Advantage: more type-safety.
// Disadvantages:
// - takes up more space because Rust doesn't collapse nested enum tags
// - more verbose
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Expr {
Unary(UnaryExpr),
Binary(BinaryExpr),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BinaryOperator {
Add,
Sub,
Mul,
Div,
Rem,
BitAnd,
BitOr,
BitXor,
BitClear,
LeftShift,
RightShift,
Equals,
NotEqual,
LessThan,
LessThanOrEqual,
GreaterThan,
GreaterThanOrEqual,
LogAnd,
LogOr,
}
impl BinaryOperator {
pub fn from_token_kind(tok: TokenKind) -> Option<BinaryOperator> {
use self::BinaryOperator::*;
Some(match tok {
TokenKind::Plus => Add,
TokenKind::Minus => Sub,
TokenKind::Star => Mul,
TokenKind::Slash => Div,
TokenKind::Percent => Rem,
TokenKind::And => BitAnd,
TokenKind::Or => BitOr,
TokenKind::Caret => BitXor,
TokenKind::BitClear => BitClear,
TokenKind::Lshift => LeftShift,
TokenKind::Rshift => RightShift,
TokenKind::Equals => Equals,
TokenKind::NotEqual => NotEqual,
TokenKind::LessThan => LessThan,
TokenKind::LessThanOrEqual => LessThanOrEqual,
TokenKind::GreaterThan => GreaterThan,
TokenKind::GreaterThanOrEqual => GreaterThanOrEqual,
TokenKind::AndAnd => LogAnd,
TokenKind::OrOr => LogOr,
_ => return None,
})
}
pub fn from_token_kind_assign_op(tok: TokenKind) -> Option<BinaryOperator> {
use self::BinaryOperator::*;
Some(match tok {
TokenKind::PlusAssign => Add,
TokenKind::MinusAssign => Sub,
TokenKind::StarAssign => Mul,
TokenKind::SlashAssign => Div,
TokenKind::PercentAssign => Rem,
TokenKind::AndAssign => BitAnd,
TokenKind::OrAssign => BitOr,
TokenKind::CaretAssign => BitXor,
TokenKind::BitClearAssign => BitClear,
TokenKind::LshiftAssign => LeftShift,
TokenKind::RshiftAssign => RightShift,
_ => return None,
})
}
pub fn precedence(self) -> i32 {
use self::BinaryOperator::*;
match self {
Mul | Div | Rem | LeftShift | RightShift | BitAnd | BitClear => 5,
Add | Sub | BitOr | BitXor => 4,
Equals | NotEqual | LessThan | LessThanOrEqual | GreaterThan | GreaterThanOrEqual => 3,
LogAnd => 2,
LogOr => 1,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BinaryExpr {
pub lhs: Box<Spanned<Expr>>,
pub op: BinaryOperator,
pub rhs: Box<Spanned<Expr>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum UnaryExpr {
Primary(Box<PrimaryExpr>),
UnaryOperation(UnaryOperation),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct UnaryOperation {
pub operator: UnaryOperator, // TODO: type safety
pub operand: Box<Spanned<UnaryExpr>>,
}
// TODO
/// A unary operator.
///
/// ## Grammar
///
/// ```ignore
/// unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum UnaryOperator {
Plus,
Minus,
Not,
Xor,
Deref,
And,
ChanReceive,
}
impl UnaryOperator {
pub fn from_token_kind(k: TokenKind) -> Option<UnaryOperator> {
use self::UnaryOperator::*;
Some(match k {
TokenKind::Plus => Plus,
TokenKind::Minus => Minus,
TokenKind::Not => Not,
TokenKind::Caret => Xor,
TokenKind::Star => Deref,
TokenKind::And => And,
TokenKind::Arrow => ChanReceive,
_ => return None,
})
}
}
// pub enum
// Primary expressions.
// PrimaryExpr =
// Operand |
// Conversion |
// PrimaryExpr Selector |
// PrimaryExpr Index |
// PrimaryExpr Slice |
// PrimaryExpr TypeAssertion |
// PrimaryExpr Arguments .
//
// Selector = "." identifier .
// Index = "[" Expr "]" .
// Slice = "[" ( [ Expr ] ":" [ Expr ] ) |
// ( [ Expr ] ":" Expr ":" Expr )
// "]" .
// TypeAssertion = "." "(" Type ")" .
// Arguments = "(" [ ( ExprList | Type [ "," ExprList ] ) [ "..." ] [ "," ] ] ")".
// Conversion = Type "(" Expression [ "," ] ")" .
/// Primary expressions are the operands for unary and binary expressions.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PrimaryExpr {
Operand(Operand),
Conversion(Conversion),
SelectorExpr(SelectorExpr),
Indexing(IndexExpr),
Slicing(SliceExpr),
TypeAssertion(TypeAssertion),
FuncCall(FuncCall),
}
/// Operands denote the elementary values in an expression. An operand may be a literal, a
/// (possibly qualified) non-blank identifier denoting a constant, variable, or function, a method
/// expression yielding a function, or a parenthesized expression.
// XXX/FIXME/TODO: not finished.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Operand {
/// A literal.
Lit(Literal),
/// An identifier denoting a constant, a variable or a function.
MaybeQualifiedIdent(MaybeQualifiedIdent),
/// A method expression.
MethodExpr(MethodExpr),
/// A parenthesized expression.
Expr(Expr),
}
/// A selector expression.
///
/// ## Grammar
///
/// ```ignore
/// SelectorExpr = PrimaryExpr "." identifier .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SelectorExpr {
pub operand: Box<PrimaryExpr>,
pub selector: Ident,
}
/// An index expression.
///
/// ## Grammar
///
/// ```ignore
/// IndexExpr = PrimaryExpr "[" Expression "]" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct IndexExpr {
pub operand: Box<Spanned<PrimaryExpr>>,
pub index: Spanned<Expr>,
}
/// A slice expression.
///
/// ## Grammar
///
/// ```ignore
/// SliceExpr = PrimaryExpr "[" ( [ Expression ] ":" [ Expression ] ) |
/// ( [ Expression ] ":" Expression ":" Expression )
/// "]" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SliceExpr {
pub operand: Box<Spanned<PrimaryExpr>>,
pub slicing: Slicing,
}
// XXX: naming
// From the Go spec:
//
// For an array, pointer to array, or slice a (but not a string), the primary expression
//
// a[low : high : max]
//
// constructs a slice of the same type, and with the same length and elements as the simple slice
// expression a[low : high]. Additionally, it controls the resulting slice's capacity by setting it
// to max - low. Only the first index may be omitted; it defaults to 0. After slicing the array a
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Slicing {
pub low: Spanned<Expr>,
pub high: Spanned<Expr>,
pub max: Option<Spanned<Expr>>,
}
/// A TypeAssertion contains the expression whose type is being asserted.
/// This superficially differs from the grammar in the Go spec.
// XXX: wrap both fields in Spanned<T>
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TypeAssertion {
/// The expression whose type is being asserted.
pub expr: Box<PrimaryExpr>,
/// The 'target type'.
/// If None, we're in a type switch (`x.(type)` - with the literal `type` keyword).
pub typ: Option<Type>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FuncCall {
pub callee: Box<Spanned<PrimaryExpr>>,
pub args: Arguments,
}
/// A method expression.
///
/// If M is in the method set of type T, T.M is a function that is callable as a regular function
/// with the same arguments as M prefixed by an additional argument that is the receiver of the
/// method.
///
/// ## Grammar
///
/// ```ignore
/// MethodExpr = ReceiverType "." MethodName .
/// ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MethodExpr {
/// Receiver type.
pub receiver: Type,
/// Name of the method.
pub name: String,
}
================================================
FILE: src/ast/mod.rs
================================================
//! The Abstract Syntax Tree.
//!
//! If you want to learn more, it is recommended to read the [Go language
//! specification](https://golang.org/ref/spec).
//!
//! This module needs attention.
mod types;
mod statements;
mod expressions;
use num::bigint::BigInt;
use num::BigRational;
use token::Spanned;
pub use self::types::*;
pub use self::statements::*;
pub use self::expressions::*;
// XXX: We may want to intern strings later on.
// XXX: should we use aliases? Or resolve them in doc comments?
pub type Ident = String;
pub type TypeName = MaybeQualifiedIdent;
pub type MethodName = Ident;
/// A complete source file.
///
/// ## Grammar
///
/// ```ignore
/// SourceFile = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SourceFile {
/// Name of the package this file belongs to.
pub package: Ident,
/// All import declarations in this file.
pub import_decls: Vec<Spanned<ImportDecl>>,
/// All top-level declarations in this file.
pub top_level_decls: Vec<TopLevelDecl>,
}
/// An import declaration.
/// Contains a list of "import specs".
///
/// ## Grammar
///
/// ```ignore
/// ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .
/// ```
///
/// Example:
///
/// ``` go
/// import (
/// "fmt"
/// "io/ioutil"
/// )
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ImportDecl {
pub specs: Vec<Spanned<ImportSpec>>,
}
/// An import spec.
///
/// This can only appear in an import declaration (AFAIK).
///
/// ## Grammar
///
/// ```ignore
/// ImportSpec = [ "." | PackageName ] ImportPath .
/// ImportPath = string_lit .
/// ```
///
/// Example:
///
/// ```ignore
/// m "lib/math"
/// ```
///
/// This imports `lib/math` as `m`.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ImportSpec {
pub kind: ImportKind,
pub path: Spanned<Vec<u8>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ImportKind {
/// Regular import: the kind you encounter most often.
Normal,
/// Aliased import: defines an alias for the imported package.
Alias(String),
/// Glob import: all the package's exported identifiers will be declared in the importing
/// source file.
Glob,
}
#[derive(Debug, Clone, PartialEq, Eq)]
/// A top-level declaration - i.e. a declaration that may appear immediately after import
/// declarations.
pub enum TopLevelDecl {
Statement(DeclStmt),
Func(FuncDecl),
Method(MethodDecl),
}
// From the Go spec:
//
// FunctionDecl = "func" FunctionName ( Function | Signature ) .
// FunctionName = identifier .
// Function = Signature FunctionBody .
// FunctionBody = Block .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FuncDecl {
// XXX: functions with same name but different origins, how do we handle them?
pub name: Spanned<String>,
pub signature: FuncSignature,
pub body: Option<Block>,
}
/// A function signature: return type(s) and argument types.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FuncSignature {
pub parameters: Parameters,
// Yes, the result of a function is a `Parameters` struct.
pub result: Parameters,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Parameters {
pub decls: Vec<ParameterDecl>,
}
impl Parameters {
/// Create an empty parameter list.
pub fn empty() -> Parameters {
Parameters { decls: Vec::new() }
}
/// Create a parameter list containing a single, unnamed type.
pub fn from_single_type(t: Type) -> Parameters {
Parameters {
decls: vec![ParameterDecl {
identifiers: vec![],
typ: t,
variadic: false,
}],
}
}
}
// TODO: variadic functions.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParameterDecl {
pub identifiers: Vec<String>,
/// The type assigned to every identifier in this declaration.
pub typ: Type,
// XXX: review this.
// ONLY the last ParameterDecl of a Parameters struct may be variadic.
// And only if it's part of _input_ parameters.
pub variadic: bool,
}
// XXX: types need attention.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Type {
Plain(MaybeQualifiedIdent),
Literal(Box<TypeLiteral>),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TypeLiteral {
Array(ArrayType),
Struct(StructType),
Pointer(PointerType),
Func(FuncType),
Interface(InterfaceType),
Slice(SliceType),
Map(MapType),
Chan(ChanType),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Literal {
Basic(BasicLit),
Composite(CompositeLit),
Func(FuncLit),
}
/// A _potentially_ qualified identifier (e.g. `math.Sin`, but also `someUnqualifiedIdent`).
///
/// "A qualified identifier is an identifier qualified with a package name prefix."
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MaybeQualifiedIdent {
pub package: Option<Ident>,
pub name: Ident,
}
/// A constant declaration binds a list of identifiers (the names of the constants) to the values
/// of a list of constant expressions.
///
/// ## Grammar
///
/// ```ignore
/// ConstDecl = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .
/// ```
///
/// Example: `const Pi float64 = 3.14159265358979323846`
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConstDecl {
pub specs: Vec<ConstSpec>,
}
// TODO: docs
/// ## Grammar
///
/// ```ignore
/// ConstSpec = IdentifierList [ [ Type ] "=" ExpressionList ] .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConstSpec {
pub idents: Vec<Spanned<Ident>>,
pub inner: Option<ConstSpecInner>,
}
// XXX: naming
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConstSpecInner {
pub typ: Option<Type>,
pub exprs: Vec<Expr>,
}
/// A method is a function with a receiver. A method declaration binds an identifier, the method
/// name, to a method, and associates the method with the receiver's base type.
///
/// ## Grammar
///
/// ```ignore
/// MethodDecl = "func" Receiver MethodName ( Function | Signature ) .
/// Receiver = Parameters .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MethodDecl {
pub receiver: Parameters,
pub name: Spanned<Ident>,
pub signature: FuncSignature,
pub body: Option<Block>,
}
/// A type declaration binds an identifier, the type name, to a new type that has the same
/// underlying type as an existing type, and operations defined for the existing type are also
/// defined for the new type.
///
/// ## Grammar
///
/// ```ignore
/// TypeDecl = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) .
/// TypeSpec = identifier Type .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TypeDecl {
pub specs: Vec<Spanned<TypeSpec>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TypeSpec {
pub ident: Spanned<Ident>,
pub typ: Spanned<Type>,
}
/// A variable declaration creates one or more variables, binds corresponding identifiers to them,
/// and gives each a type and an initial value.
///
/// ## Grammar
///
/// ```ignore
/// VarDecl = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct VarDecl {
pub specs: Vec<Spanned<VarSpec>>,
}
/// ## Grammar
///
/// ```ignore
/// VarSpec = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct VarSpec {
pub idents: Vec<Spanned<Ident>>,
pub typ: Option<Type>,
pub exprs: Vec<Spanned<Expr>>,
}
/// Conversions are expressions of the form T(x) where T is a type and x is an expression that can
/// be converted to type T.
///
/// ## Grammar
///
/// ```ignore
/// Conversion = Type "(" Expression [ "," ] ")" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Conversion {
/// The type to convert to.
pub typ: Spanned<Type>,
/// The expression being converted.
pub expr: Spanned<Expr>,
}
// ShortVarDecl = IdentifierList ":=" ExpressionList .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ShortVarDecl {
pub lhs: Vec<Spanned<Ident>>,
pub rhs: Vec<Spanned<Expr>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Block(pub Vec<Statement>);
// XXX/FIXME: review and fix this.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum BasicLit {
Int(BigInt),
Float(BigRational),
Imaginary(BigRational),
Rune(char),
Str(Vec<u8>),
}
/// Composite literals construct values for structs, arrays, slices, and maps and create a new
/// value each time they are evaluated. They consist of the type of the literal followed by a
/// brace-bound list of elements. Each element may optionally be preceded by a corresponding key.
///
/// ## Grammar
///
/// ```ignore
/// CompositeLit = LiteralType LiteralValue .
/// LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
/// SliceType | MapType | TypeName .
/// LiteralValue = "{" [ ElementList [ "," ] ] "}" .
/// ElementList = KeyedElement { "," KeyedElement } .
/// KeyedElement = [ Key ":" ] Element .
/// Key = FieldName | Expression | LiteralValue .
/// FieldName = identifier .
/// Element = Expression | LiteralValue .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CompositeLit {
pub typ: Spanned<LiteralType>,
pub val: LiteralValue,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum LiteralType {
Struct(StructType),
Array(ArrayType),
// FIXME: MISSING: `[...]int` array (computes size at compile time)
Slice(SliceType),
Map(MapType),
Type(MaybeQualifiedIdent),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LiteralValue {
pub elems: Vec<KeyedElem>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct KeyedElem {
pub key: Option<Spanned<Key>>,
pub elem: Spanned<Elem>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Key {
FieldName(Ident),
Expr(Expr),
LiteralValue(LiteralValue),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Elem {
Expr(Expr),
LiteralValue(LiteralValue),
}
/// A function literal represents an anonymous function.
///
/// ## Grammar
///
/// ```ignore
/// FunctionLit = "func" Function .
/// Function = Signature FunctionBody .
/// FunctionBody = Block .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FuncLit {
pub signature: FuncSignature,
pub body: Block,
}
#[derive(Debug, Clone, PartialEq, Eq)]
/// A list of arguments being passed to a function.
///
/// Arguments can't just be a list of expressions, because Go has a built-in generic generic
/// functions: `make` and `new`, and these functions take a **type** instead of an expression
/// as their first argument.
pub struct Arguments {
pub typ: Option<Spanned<Type>>,
pub expressions: Vec<Spanned<Expr>>,
}
================================================
FILE: src/ast/statements.rs
================================================
use super::{Block, Expr, ShortVarDecl, ConstDecl, TypeDecl, VarDecl, BinaryOperator};
use token::Spanned;
// Statement =
// Declaration | LabeledStmt | SimpleStmt |
// GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
// FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
// DeferStmt .
//
// SimpleStmt = EmptyStmt | ExprStmt | SendStmt | IncDecStmt | Assignment | ShortVarDecl .
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Statement {
Decl(DeclStmt),
Labeled(LabeledStmt),
Simple(SimpleStmt),
Go(GoStmt),
Return(ReturnStmt),
Break(BreakStmt),
Continue(ContinueStmt),
Goto(GotoStmt),
Fallthrough(FallthroughStmt),
Block(Block),
If(IfStmt),
Switch(SwitchStmt),
Select(SelectStmt),
For(ForStmt),
Defer(DeferStmt),
Empty(EmptyStmt),
}
macro_rules! enum_from_impl {
($enum_type:ident, $(($enum_variant:ident, $inner_type:ty)),*) => {
$(
impl From<$inner_type> for $enum_type {
fn from(x: $inner_type) -> $enum_type {
$enum_type::$enum_variant(x)
}
}
)*
}
}
enum_from_impl!(Statement,
(Decl, DeclStmt),
(Labeled, LabeledStmt),
(Simple, SimpleStmt),
(Go, GoStmt),
(Return, ReturnStmt),
(Break, BreakStmt),
(Continue, ContinueStmt),
(Goto, GotoStmt),
(Fallthrough, FallthroughStmt),
(Block, Block),
(If, IfStmt),
(Switch, SwitchStmt),
(Select, SelectStmt),
(For, ForStmt),
(Defer, DeferStmt),
(Empty, EmptyStmt));
/// A simple statement.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SimpleStmt {
EmptyStmt,
Expr(Spanned<Expr>),
Send(SendStmt),
IncDec(IncDecStmt),
Assignment(Assignment),
ShortVarDecl(ShortVarDecl),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LabeledStmt;
/// A "go" statement starts the execution of a function call as an independent concurrent thread of
/// control, or goroutine, within the same address space.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GoStmt {
/// The function or method call being started.
pub call: Spanned<Expr>,
}
/// A "defer" statement invokes a function whose execution is deferred to the moment the
/// surrounding function returns, either because the surrounding function executed a return
/// statement, reached the end of its function body, or because the corresponding goroutine is
/// panicking.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeferStmt {
/// The function or method call being deferred.
pub call: Spanned<Expr>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReturnStmt {
/// The expression being returned.
pub expr: Spanned<Expr>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BreakStmt {
/// An optional label referring to an enclosing "for", "switch", or "select".
pub label: Option<Spanned<String>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ContinueStmt {
/// An optional label referring to an enclosing "for", "switch", or "select".
pub label: Option<Spanned<String>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GotoStmt {
pub label: Spanned<String>,
}
/// "Fallthrough" statements contain no associated data!
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FallthroughStmt;
/// "If" statements specify the conditional execution of two branches according to the value of a
/// boolean expression. If the expression evaluates to true, the "if" branch is executed,
/// otherwise, if present, the "else" branch is executed.
///
/// The expression may be preceded by a simple statement, which executes before the expression is
/// evaluated.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct IfStmt {
pub before_stmt: Option<Spanned<SimpleStmt>>,
pub condition: Spanned<Expr>,
pub block: Block,
pub opt_else: Option<Box<Else>>,
}
/// The "else" portion of an if statement.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Else {
/// `else if <condition> { ... }`
If(IfStmt),
/// `else { ... }`
Block(Block),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SwitchStmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SelectStmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ForStmt {
/// The "header" is the part of of a `for` that comes before the body.
pub header: ForHeader,
pub body: Block,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ForHeader {
Condition(Expr),
ForClause(ForClause),
RangeClause(RangeClause),
}
// Grammar:
//
// ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] .
// InitStmt = SimpleStmt .
// PostStmt = SimpleStmt .
// Condition = Expression .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ForClause {
pub init: Option<SimpleStmt>,
pub condition: Option<Expr>,
pub post: Option<SimpleStmt>,
}
// RangeClause = [ ExpressionList "=" | IdentifierList ":=" ] "range" Expression .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RangeClause {
/// The iteration variables.
pub iter_vars: IterVars,
/// The range expression.
pub expr: Spanned<Expr>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum IterVars {
Exprs(Vec<Spanned<Expr>>),
Idents(Vec<Spanned<String>>),
}
// SendStmt = Channel "<-" Expression .
// Channel = Expression .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SendStmt {
pub channel: Spanned<Expr>,
pub expr: Spanned<Expr>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct IncDecStmt {
pub expr: Spanned<Expr>,
pub is_dec: bool, // false for ++, true for --
}
// Assignment = ExpressionList assign_op ExpressionList .
// assign_op = [ add_op | mul_op ] "=" .
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Assignment {
pub lhs: Vec<Spanned<Expr>>,
pub rhs: Vec<Spanned<Expr>>,
// binary operation used in assign op
// XXX: add method to BinaryOperator to check if is a valid assign_op operation
pub op: Option<BinaryOperator>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EmptyStmt;
// Declaration = ConstDecl | TypeDecl | VarDecl .
/// A statement declaration.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DeclStmt {
Const(ConstDecl),
TypeDecl(TypeDecl),
VarDecl(VarDecl),
}
================================================
FILE: src/ast/types.rs
================================================
use super::*;
/// An array type.
///
/// ## Grammar
///
/// ```ignore
/// ArrayType = "[" ArrayLength "]" ElementType .
/// ArrayLength = Expression .
/// ElementType = Type .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ArrayType {
pub len: Expr,
pub element_type: Type,
}
/// A struct type.
///
/// ## Grammar
///
/// ```ignore
/// StructType = "struct" "{" { FieldDecl ";" } "}" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StructType {
pub field_decls: Vec<FieldDecl>,
}
/// An inner field decl.
///
/// ## Grammar
///
/// ```ignore
/// FieldDecl = (IdentifierList Type | AnonymousField) [ Tag ] .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FieldDecl {
pub inner: InnerFieldDecl,
pub tag: Option<Vec<u8>>, // Go string literal; TODO proper wrapper type
}
/// An InnerFieldDecl.
///
/// ## Grammar
///
/// ```ignore
/// AnonymousField = [ "*" ] TypeName .
/// Tag = string_lit .
/// TypeName = identifier | QualifiedIdent .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InnerFieldDecl {
Named {
idents: Vec<Ident>,
typ: Type,
},
Anonymous {
is_ptr: bool,
type_name: MaybeQualifiedIdent,
},
}
/// A type which is a pointer to a base type.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PointerType(pub Type);
/// A function type denotes the set of all functions with the same parameter and result types. The
/// value of an uninitialized variable of function type is nil.
///
/// ## Grammar
///
/// ```ignore
/// FunctionType = "func" Signature .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FuncType {
pub signature: FuncSignature,
}
/// An interface type specifies a method set called its interface.
///
/// ## Grammar
///
/// ```ignore
/// InterfaceType = "interface" "{" { MethodSpec ";" } "}" .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct InterfaceType {
pub specs: Vec<MethodSpec>,
}
/// An interface method spec.
///
/// ## Grammar
///
/// ```ignore
/// MethodSpec = MethodName Signature | InterfaceTypeName .
/// MethodName = identifier .
/// InterfaceTypeName = TypeName .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MethodSpec {
pub name: Ident,
pub method: InnerMethodSpec,
}
// XXX: naming things is hard
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InnerMethodSpec {
Signature(FuncSignature),
InterfaceName(TypeName),
}
/// A slice type denotes the set of all slices of arrays of its element type.
///
/// ## Grammar
///
/// ```ignore
/// SliceType = "[" "]" ElementType .
/// ElementType = Type .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SliceType {
pub element_type: Type,
}
/// A map is an unordered group of elements of one type, called the element type, indexed by a set
/// of unique keys of another type, called the key type.
/// ## Grammar
///
/// ```ignore
/// MapType = "map" "[" KeyType "]" ElementType .
/// KeyType = Type .
/// ElementType = Type .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MapType {
pub key_type: Type,
pub element_type: Type,
}
/// A channel provides a mechanism for concurrently executing functions to communicate by sending
/// and receiving values of a specified element type.
///
/// ## Grammar
///
/// ```ignore
/// ChannelType = ( "chan" | "chan" "<-" | "<-" "chan" ) ElementType .
/// ElementType = Type .
/// ```
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChanType {
pub element_type: Type,
pub direction: ChanDirection,
}
/// The optional <- operator specifies the **channel direction**, send or receive. If no direction
/// is given, the channel is bidirectional.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ChanDirection {
/// No arrow.
Bidirectional,
/// Arrow on the right: `chan<-`
Send,
/// Arrow on the left: `<-chan`
Receive,
}
================================================
FILE: src/lexer/mod.rs
================================================
//! # Lexer
//!
//! A `Lexer` parses a source string into a list of tokens, which may later be used to construct an
//! Abstract Syntax Tree.
//!
//! ## Notes
//!
//! - We want meaningful errors from the start. That means printing the line and column number on
//! error, returning `Result`s instead of panicking (later on, we may use unwinding to speed up
//! lexical analysis in non-erroneous cases).
//!
//! - It is unclear whether we should operator on Unicode `char`, or plain bytes `u8`. `char`s are
//! more convenient to display and offer a clean API; bytes are (most likely) faster to work with.
//!
//! - I'm not sure what the best way to store tokens is. A slice into the original source, an
//! interned string...? Probably an interned string, this is what rustc uses and it speeds up
//! comparisons, which are going to be very frequent. Probably reduces allocations, too - and we're
//! allocating a _lot_. We'd have to benchmark to be sure.
use std::iter::Iterator;
pub use token::*;
#[cfg(test)]
mod test;
pub struct Lexer<'src> {
/// Byte offset from the start of the source string.
offset: usize,
/// The source string.
src: &'src str,
/// The last character to be read.
current_char: Option<char>,
/// The kind of token we read last. Used for automatic semicolon insertion.
last_token_kind: Option<TokenKind>,
}
impl<'src> Lexer<'src> {
/// Create a new Lexer from the given source string.
pub fn new(s: &str) -> Lexer {
// Initialize the lexer with the first character of the source string.
let first_char = s.chars().next();
Lexer {
src: s,
offset: 0,
current_char: first_char,
last_token_kind: None,
}
}
/// 'eat' one character.
/// This is a _very_ hot function.
fn bump(&mut self) {
self.offset += self.current_char.unwrap().len_utf8();
if self.offset < self.src.len() {
let ch = char_at(&self.src, self.offset);
self.current_char = Some(ch);
} else {
self.current_char = None;
}
}
/// Return the next character **without** bumping.
/// Useful for lookahead.
fn next_char(&self) -> Option<char> {
let next_offset = self.offset + 1;
if next_offset < self.src.len() {
let ch = char_at(&self.src, next_offset);
Some(ch)
} else {
None
}
}
/// Scan a number literal (integer or float).
///
/// The literal "0" is considered octal, [as in
/// C++](http://stackoverflow.com/a/6895543/2754323).
fn scan_number(&mut self) -> Token {
// Integer literal grammar:
//
// int_lit = decimal_lit | octal_lit | hex_lit .
// decimal_lit = ( "1" … "9" ) { decimal_digit } .
// octal_lit = "0" { octal_digit } .
// hex_lit = "0" ( "x" | "X" ) hex_digit { hex_digit } .
let start = self.offset;
// If we have a hexadecimal, treat it specially.
if self.current_char == Some('0') &&
(self.next_char() == Some('x') || self.next_char() == Some('x')) {
self.bump();
self.bump();
while let Some(c) = self.current_char {
if c.is_digit(16) {
self.bump();
} else {
break;
}
}
return Token {
value: Some(self.src[start..self.offset].into()),
kind: TokenKind::Hex,
};
}
let has_leading_zero = self.current_char == Some('0');
let mut had_e = false;
let mut had_dot = false;
'outer: while let Some(c) = self.current_char {
if c.is_digit(10) {
self.bump();
} else if !had_e && (c == 'e' || c == 'E') {
self.bump();
had_e = true;
if self.current_char == Some('+') || self.current_char == Some('-') {
self.bump();
}
} else if !had_e && !had_dot && c == '.' {
self.bump();
had_dot = true;
} else if c == 'i' {
self.bump();
return Token {
value: Some(self.src[start..self.offset].into()),
kind: TokenKind::Imaginary,
};
} else {
break;
}
}
let s = &self.src[start..self.offset];
let kind = if had_e || had_dot {
TokenKind::Float
} else if has_leading_zero {
TokenKind::Octal
} else {
TokenKind::Decimal
};
Token {
value: Some(s.into()),
kind: kind,
}
}
/// Skip whitespace and comments, returning whether at least one newline was encountered.
fn skip_whitespace_and_comments(&mut self) -> bool {
let mut contains_newline = false;
while let Some(c) = self.current_char {
if c == '\n' {
contains_newline = true;
}
// Are we at the start of a general comment (`/* ... */`)?
if c == '/' && self.next_char() == Some('*') {
// Skip the '/*'.
self.bump();
self.bump();
// Skip the comment body.
while let Some(c) = self.current_char {
if c == '*' && self.next_char() == Some('/') {
break;
} else {
self.bump();
}
}
// Skip the '*/'.
self.bump();
self.bump();
// Resume whitespace skipping.
continue;
} else if c == '/' && self.next_char() == Some('/') {
while let Some(c) = self.current_char {
if c == '\n' {
break;
} else {
self.bump();
}
}
// Resume whitespace skipping.
// Since we have not bumped past the newline character,
// the next iteration of the loop will catch it.
continue;
}
if c.is_whitespace() {
self.bump();
} else {
break;
}
}
contains_newline
}
fn scan_ident(&mut self) -> &str {
let start = self.offset;
while let Some(c) = self.current_char {
if can_continue_identifier(c) {
self.bump();
} else {
break;
}
}
&self.src[start..self.offset]
}
fn scan_ident_or_keyword(&mut self) -> Token {
let ident = self.scan_ident();
let mut value = None;
use token::TokenKind::*;
let kind = match &*ident {
"break" => Break,
"case" => Case,
"chan" => Chan,
"const" => Const,
"continue" => Continue,
"default" => Default,
"defer" => Defer,
"else" => Else,
"fallthrough" => Fallthrough,
"for" => For,
"func" => Func,
"go" => Go,
"goto" => Goto,
"if" => If,
"import" => Import,
"interface" => Interface,
"map" => Map,
"package" => Package,
"range" => Range,
"return" => Return,
"select" => Select,
"struct" => Struct,
"switch" => Switch,
"type" => Type,
"var" => Var,
// XXX(perf): unnecessary alloc.
_ => {
value = Some(ident.into());
TokenKind::Ident
}
};
Token {
kind: kind,
value: value,
}
}
/// Return the next token, if any.
fn next_token_inner(&mut self) -> Option<Token> {
// Whitespace and comment handling.
let contains_newline = self.skip_whitespace_and_comments();
// Automatic semicolon insertion in the simplest case (newline + token that may terminate a
// statement).
//
// The Go Spec also says that a semicolon may be omitted before a closing ")" or "}".
// This case is _not_ handled by the lexer, but by the parser, as it requires too much
// context.
if contains_newline && may_terminate_statement(self.last_token_kind) {
return Some(Token {
kind: TokenKind::Semicolon,
value: None,
});
}
// Check for EOF after whitespace handling.
let c = match self.current_char {
Some(c) => c,
None => return None,
};
let kind = match c {
// Single-character tokens.
'(' => {
self.bump();
TokenKind::LParen
}
')' => {
self.bump();
TokenKind::RParen
}
'{' => {
self.bump();
TokenKind::LBrace
}
'}' => {
self.bump();
TokenKind::RBrace
}
'[' => {
self.bump();
TokenKind::LBracket
}
']' => {
self.bump();
TokenKind::RBracket
}
',' => {
self.bump();
TokenKind::Comma
}
';' => {
self.bump();
TokenKind::Semicolon
}
// More complex tokens.
'.' => {
if self.next_char().map(|x| x.is_digit(10)) == Some(true) {
return Some(self.scan_number());
}
self.bump();
// Look for an ellipsis ('...').
if self.current_char == Some('.') && self.next_char() == Some('.') {
self.bump();
self.bump();
TokenKind::Ellipsis
} else {
TokenKind::Dot
}
}
':' => {
self.bump();
if self.current_char == Some('=') {
self.bump();
TokenKind::ColonAssign
} else {
TokenKind::Colon
}
}
'=' => {
self.bump();
if self.current_char == Some('=') {
self.bump();
TokenKind::Equals
} else {
TokenKind::Assign
}
}
'+' => {
self.bump();
match self.current_char {
Some('+') => {
self.bump();
TokenKind::Increment
}
Some('=') => {
self.bump();
TokenKind::PlusAssign
}
_ => TokenKind::Plus,
}
}
'-' => {
self.bump();
match self.current_char {
Some('-') => {
self.bump();
TokenKind::Decrement
}
Some('=') => {
self.bump();
TokenKind::MinusAssign
}
_ => TokenKind::Minus,
}
}
'*' => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::StarAssign
}
_ => TokenKind::Star,
}
}
'/' => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::SlashAssign
}
_ => TokenKind::Slash,
}
}
'<' => {
self.bump();
match self.current_char {
Some('<') => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::LshiftAssign
}
_ => TokenKind::Lshift,
}
}
Some('=') => {
self.bump();
TokenKind::LessThanOrEqual
}
Some('-') => {
self.bump();
TokenKind::Arrow
}
_ => TokenKind::LessThan,
}
}
'>' => {
self.bump();
match self.current_char {
Some('>') => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::RshiftAssign
}
_ => TokenKind::Rshift,
}
}
Some('=') => {
self.bump();
TokenKind::GreaterThanOrEqual
}
_ => TokenKind::GreaterThan,
}
}
'|' => {
self.bump();
match self.current_char {
Some('|') => {
self.bump();
TokenKind::OrOr
}
Some('=') => {
self.bump();
TokenKind::OrAssign
}
_ => TokenKind::Or,
}
}
'&' => {
self.bump();
match self.current_char {
Some('&') => {
self.bump();
TokenKind::AndAnd
}
Some('=') => {
self.bump();
TokenKind::AndAssign
}
Some('^') => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::BitClearAssign
}
_ => TokenKind::BitClear,
}
}
_ => TokenKind::And,
}
}
'!' => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::NotEqual
}
_ => TokenKind::Not,
}
}
'^' => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::CaretAssign
}
_ => TokenKind::Caret,
}
}
'%' => {
self.bump();
match self.current_char {
Some('=') => {
self.bump();
TokenKind::PercentAssign
}
_ => TokenKind::Percent,
}
}
// Scan integer.
c if c.is_digit(10) => return Some(self.scan_number()),
c if can_start_identifier(c) => return Some(self.scan_ident_or_keyword()),
// Start of _interpreted_ string literal.
'"' => return Some(self.scan_interpreted_str_lit()),
'`' => return Some(self.scan_raw_str_lit()),
'\'' => return Some(self.scan_rune_lit()),
c => panic!("unexpected start of token: '{}'", c),
};
Some(Token {
kind: kind,
value: None,
})
}
fn scan_rune_lit(&mut self) -> Token {
self.bump();
let start = self.offset;
while let Some(c) = self.current_char {
// If we encounter a backslash escape, we just skip past the '\' and the
// following character.
if c == '\\' {
self.bump();
self.bump();
} else if c == '\'' {
break;
} else {
self.bump();
}
}
let s = &self.src[start..self.offset];
// Skip the quote _after_ slicing so that it isn't included
// in the slice.
self.bump();
Token {
value: Some(s.into()),
kind: TokenKind::Rune,
}
}
fn scan_interpreted_str_lit(&mut self) -> Token {
self.bump();
let start = self.offset;
while let Some(c) = self.current_char {
// If we encounter a backslash escape, we just skip past the '\' and the
// following character.
if c == '\\' {
self.bump();
self.bump();
} else if c == '"' {
break;
} else {
self.bump();
}
}
let s = &self.src[start..self.offset];
// Skip the quote _after_ slicing so that it isn't included
// in the slice.
self.bump();
Token {
// XXX(perf): alloc.
value: Some(s.into()),
kind: TokenKind::Str,
}
}
fn scan_raw_str_lit(&mut self) -> Token {
// Bump past the opening backtrick.
self.bump();
let start = self.offset;
while let Some(c) = self.current_char {
// Raw strings are pretty simple, because we don't have to handle escapes.
if c == '`' {
break;
} else {
self.bump();
}
}
let s = &self.src[start..self.offset];
// Skip the backtick _after_ slicing so that it isn't included
// in the slice.
self.bump();
Token {
// XXX(perf): alloc.
value: Some(s.into()),
kind: TokenKind::StrRaw,
}
}
}
impl<'src> Iterator for Lexer<'src> {
type Item = TokenAndSpan;
fn next(&mut self) -> Option<TokenAndSpan> {
let start = self.offset as u32;
let t = self.next_token_inner();
self.last_token_kind = t.as_ref().map(|t| t.kind);
t.map(|t| {
TokenAndSpan {
token: t,
span: Span {
start: start,
end: self.offset as u32,
},
}
})
}
}
/// Convenience function to collect all the tokens from a string.
pub fn tokenize(s: &str) -> Vec<TokenAndSpan> {
let lexer = Lexer::new(s);
lexer.collect()
}
// =====
// Utility functions.
//
// XXX(perf): expensive checks on Unicode chars (is_alphabetic(), is_numeric()) in these functions.
// =====
fn can_start_identifier(c: char) -> bool {
c.is_alphabetic() || c == '_'
}
fn can_continue_identifier(c: char) -> bool {
c.is_alphabetic() || c.is_numeric() || c == '_'
}
fn char_at(s: &str, byte: usize) -> char {
s[byte..].chars().next().unwrap()
}
// For automatic semicolon insertion.
fn may_terminate_statement(t: Option<TokenKind>) -> bool {
// A non-existent token may not terminate a line.
let t = match t {
Some(t) => t,
None => return false,
};
// From the Go spec:
//
// When the input is broken into tokens, a semicolon is automatically inserted into the
// token stream immediately after a line's final token if that token is:
// - an identifier
// - an integer, floating-point, imaginary, rune, or string literal
// - one of the keywords break, continue, fallthrough, or return
// - one of the operators and delimiters ++, --, ), ], or }
use token::TokenKind::*;
match t {
Ident => true,
Increment | Decrement | Break | Continue | Fallthrough | Return | RParen | RBracket |
RBrace => true,
t if t.is_literal() => true,
_ => false,
}
}
================================================
FILE: src/lexer/test.rs
================================================
use super::{Token, TokenKind, tokenize};
use token::TokenKind::*;
// XXX: use the full TokenKind::* path, or `use TokenKind::*`?
fn assert_tokens(code: &str, expect: &[(TokenKind, Option<&str>)]) {
let got = tokenize(code);
// If the assertion fails, having a log message will be very useful.
println!("got:\n{:#?}", got);
println!("\nexpected:\n{:#?}", expect);
assert_eq!(got.len(), expect.len());
for (got_t, expect_t) in got.iter().zip(expect) {
let nt = Token {
kind: expect_t.0,
value: expect_t.1.map(|s| s.to_owned()),
};
assert_eq!(got_t.token, nt);
}
}
fn assert_token(code: &str, expect_kind: TokenKind, expect_value: Option<&str>) {
assert_tokens(code, &[(expect_kind, expect_value)]);
}
#[test]
fn test_numerical_tokens() {
// Integer Literals
assert_token("42", Decimal, Some("42"));
assert_token("0600", Octal, Some("0600"));
assert_token("0xBadFace", Hex, Some("0xBadFace"));
assert_token("170141183460469231731687303715884105727",
Decimal,
Some("170141183460469231731687303715884105727"));
let float_tests =
["0.", "72.40", "072.40", "2.71828", "1.e+0", "6.67428e-11", "1E6", ".25", ".12345E+5"];
for t in &float_tests {
assert_token(t, Float, Some(t));
}
let imaginary_tests =
["0i", "011i", "0.i", "2.71828i", "1.e+0i", "6.67428e-11i", "1E6i", ".25i", ".12345E+5i"];
for t in &imaginary_tests {
assert_token(t, Imaginary, Some(t));
}
}
#[test]
fn test_text_literals() {
assert_token("'a'", Rune, Some("a"));
assert_token("'\\n'", Rune, Some("\\n"));
assert_token("'\\''", Rune, Some("\\'"));
assert_token("\"Hello!\"", Str, Some("Hello!"));
assert_token("\"\\n\\n\"", Str, Some("\\n\\n"));
assert_token("\"\\\"\"", Str, Some("\\\""));
assert_token("`Hello!`", StrRaw, Some("Hello!"));
assert_token("`\\n\\n`", StrRaw, Some("\\n\\n"));
assert_token("`\\\"`", StrRaw, Some("\\\""));
assert_token(r##""\\\"oqdz""##, Str, Some("\\\\\\\"oqdz"));
}
/// Test 'simple' tokens (tokens that do not contain a value).
#[test]
fn tokenize_simple() {
let pairs = vec![("(", TokenKind::LParen),
(")", TokenKind::RParen),
("{", TokenKind::LBrace),
("}", TokenKind::RBrace),
("[", TokenKind::LBracket),
("]", TokenKind::RBracket),
(",", TokenKind::Comma),
(";", TokenKind::Semicolon),
(".", TokenKind::Dot),
("...", TokenKind::Ellipsis),
("|", TokenKind::Or),
("||", TokenKind::OrOr),
("|=", TokenKind::OrAssign),
("!", TokenKind::Not),
("!=", TokenKind::NotEqual),
("^", TokenKind::Caret),
("^=", TokenKind::CaretAssign),
("%", TokenKind::Percent),
("%=", TokenKind::PercentAssign),
("&", TokenKind::And),
("&&", TokenKind::AndAnd),
("&=", TokenKind::AndAssign),
("&^", TokenKind::BitClear),
("&^=", TokenKind::BitClearAssign),
("&", TokenKind::And),
("&&", TokenKind::AndAnd),
("&=", TokenKind::AndAssign),
("&^", TokenKind::BitClear),
("&^=", TokenKind::BitClearAssign),
("+", TokenKind::Plus),
("++", TokenKind::Increment),
("+=", TokenKind::PlusAssign),
("-", TokenKind::Minus),
("--", TokenKind::Decrement),
("-=", TokenKind::MinusAssign),
(":", TokenKind::Colon),
(":=", TokenKind::ColonAssign),
("<", TokenKind::LessThan),
("<-", TokenKind::Arrow),
("<=", TokenKind::LessThanOrEqual),
("<<", TokenKind::Lshift),
("<<=", TokenKind::LshiftAssign),
(">", TokenKind::GreaterThan),
(">=", TokenKind::GreaterThanOrEqual),
(">>", TokenKind::Rshift),
(">>=", TokenKind::RshiftAssign),
("*", TokenKind::Star),
("*=", TokenKind::StarAssign),
("=", TokenKind::Assign),
("==", TokenKind::Equals),
("/", TokenKind::Slash),
("/=", TokenKind::SlashAssign),
];
for (src, kind) in pairs {
assert_token(src, kind, None);
}
}
#[test]
fn tokenize_comments() {
assert_tokens("// Hello, this is a comment", &[]);
assert_tokens("foo /* this is a general comment */ := 2",
&[(Ident, Some("foo")), (ColonAssign, None), (Decimal, Some("2"))]);
}
#[test]
fn tokenize_ident() {
let test_ident = |s| {
assert_tokens(s, &[(TokenKind::Ident, Some(s))]);
};
// XXX: add quickcheck test?
test_ident("foo");
}
#[test]
fn tokenize_keywords() {
let pairs = [("break", TokenKind::Break),
("case", TokenKind::Case),
("chan", TokenKind::Chan),
("const", TokenKind::Const),
("continue", TokenKind::Continue),
("default", TokenKind::Default),
("defer", TokenKind::Defer),
("else", TokenKind::Else),
("fallthrough", TokenKind::Fallthrough),
("for", TokenKind::For),
("func", TokenKind::Func),
("go", TokenKind::Go),
("goto", TokenKind::Goto),
("if", TokenKind::If),
("import", TokenKind::Import),
("interface", TokenKind::Interface),
("map", TokenKind::Map),
("package", TokenKind::Package),
("range", TokenKind::Range),
("return", TokenKind::Return),
("select", TokenKind::Select),
("struct", TokenKind::Struct),
("switch", TokenKind::Switch),
("type", TokenKind::Type),
("var", TokenKind::Var)];
for &(s, k) in &pairs {
assert_token(s, k, None);
}
}
#[test]
fn tokenize_mixed_whitespace() {
assert_tokens(" \t
\t ",
&[]);
}
#[test]
fn tokenize_package_declaration() {
assert_tokens("package main",
&[(TokenKind::Package, None), (TokenKind::Ident, Some("main"))]);
}
#[test]
fn tokenize_plain_interpreted_str() {
assert_token("\"hello\"", TokenKind::Str, Some("hello"));
}
#[test]
fn tokenize_simple_import() {
assert_tokens("import \"fmt\"",
&[(TokenKind::Import, None), (TokenKind::Str, Some("fmt"))]);
}
#[test]
fn tokenize_simple_assignment() {
assert_tokens("someVar := 23 + 45",
&[(TokenKind::Ident, Some("someVar")),
(TokenKind::ColonAssign, None),
(TokenKind::Decimal, Some("23")),
(TokenKind::Plus, None),
(TokenKind::Decimal, Some("45"))]);
}
#[test]
fn tokenize_hello() {
let src = r#"package main
import "fmt"
func main() {
fmt.Println("Hello, rgo")
}
"#;
let expected = [(TokenKind::Package, None),
(TokenKind::Ident, Some("main")),
(TokenKind::Semicolon, None),
(TokenKind::Import, None),
(TokenKind::Str, Some("fmt")),
(TokenKind::Semicolon, None),
(TokenKind::Func, None),
(TokenKind::Ident, Some("main")),
(TokenKind::LParen, None),
(TokenKind::RParen, None),
(TokenKind::LBrace, None),
(TokenKind::Ident, Some("fmt")),
(TokenKind::Dot, None),
(TokenKind::Ident, Some("Println")),
(TokenKind::LParen, None),
(TokenKind::Str, Some("Hello, rgo")),
(TokenKind::RParen, None),
(TokenKind::Semicolon, None),
(TokenKind::RBrace, None),
(TokenKind::Semicolon, None)];
assert_tokens(src, &expected);
}
// =====
// Comments
// =====
#[test]
fn tokenize_simple_assignment_with_inline_comment() {
assert_tokens("someVar /* someVar is a variable; and I'm a COMMENT! */ := 23 + 45",
&[(TokenKind::Ident, Some("someVar")),
(TokenKind::ColonAssign, None),
(TokenKind::Decimal, Some("23")),
(TokenKind::Plus, None),
(TokenKind::Decimal, Some("45"))]);
}
#[test]
fn tokenize_hello_with_comments() {
let src = r#"// This is a line comment.
// And another!
// All of these should be treated as a single contiguous whitespace block.
// Even this one!
package main
import "fmt"
func main() {
fmt.Println("Hello, rgo")
}
"#;
let expected = [(TokenKind::Package, None),
(TokenKind::Ident, Some("main")),
(TokenKind::Semicolon, None),
(TokenKind::Import, None),
(TokenKind::Str, Some("fmt")),
(TokenKind::Semicolon, None),
(TokenKind::Func, None),
(TokenKind::Ident, Some("main")),
(TokenKind::LParen, None),
(TokenKind::RParen, None),
(TokenKind::LBrace, None),
(TokenKind::Ident, Some("fmt")),
(TokenKind::Dot, None),
(TokenKind::Ident, Some("Println")),
(TokenKind::LParen, None),
(TokenKind::Str, Some("Hello, rgo")),
(TokenKind::RParen, None),
(TokenKind::Semicolon, None),
(TokenKind::RBrace, None),
(TokenKind::Semicolon, None)];
assert_tokens(src, &expected);
}
================================================
FILE: src/lib.rs
================================================
#![cfg_attr(feature="clippy", feature(plugin))]
#![cfg_attr(feature="clippy", plugin(clippy))]
#[macro_use]
extern crate log;
// XXX: do we still need this?
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate quick_error;
extern crate num;
mod pos;
pub use self::pos::Position;
pub mod token;
pub mod ast;
pub mod lexer;
pub mod parser;
pub use parser::Parser;
pub fn parse(src: &str) -> ast::SourceFile {
let lexer = lexer::Lexer::new(src).collect();
parser::parse_tokens(lexer)
}
================================================
FILE: src/main.rs
================================================
extern crate convenience;
extern crate rgo;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate time;
use convenience::read_file;
use std::env;
use time::PreciseTime;
fn main() {
env_logger::init().unwrap();
// 0th arg is the program path.
let src_file = env::args().nth(1).unwrap();
info!("Source file: {}", src_file);
let s = read_file(&src_file).expect("failed to read file");
let start = PreciseTime::now();
let tokens = rgo::lexer::tokenize(&s);
println!("Lexing: {} µs",
start.to(PreciseTime::now()).num_microseconds().unwrap());
let ast: rgo::ast::SourceFile = rgo::parser::parse_tokens(tokens);
println!("AST:\n{:?}", ast);
}
================================================
FILE: src/parser/error.rs
================================================
use std::fmt;
use token::{Span, Token, TokenKind};
pub type PResult<T> = ::std::result::Result<T, Error>;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Error {
pub span: Span,
pub kind: ErrorKind,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ErrorKind {
UnexpectedToken {
found: Token,
expected: Vec<TokenKind>,
},
Other {
msg: String,
},
}
impl ErrorKind {
pub fn unexpected_token(expected: Vec<TokenKind>, found: Token) -> ErrorKind {
ErrorKind::UnexpectedToken {
found: found,
expected: expected,
}
}
// XXX: potential code bloat due to monomorphisation, unless inlined. But we don't want to
// inline cold functions... so it could be best to remove all generics here and
// #[inline(never)].
pub fn other<T: Into<String>>(msg: T) -> ErrorKind {
ErrorKind::Other { msg: msg.into() }
}
}
impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
ErrorKind::UnexpectedToken { ref found, ref expected } => {
try!(write!(f, "expected "));
if expected.len() > 2 {
try!(write!(f, "one of "));
let mut sep = " ";
for tk in expected {
try!(write!(f, "\"{}\"{}", tk, sep));
sep = ", ";
}
} else {
try!(write!(f, "\"{}\" ", expected[0]));
}
write!(f, "found \"{}\"", found)
}
ErrorKind::Other { ref msg } => write!(f, "{}", msg),
}
}
}
================================================
FILE: src/parser/mod.rs
================================================
use std::iter::Peekable;
use num::bigint::BigInt;
use num::BigRational;
use token::*;
use ast;
#[cfg(test)]
mod test;
mod error;
pub use self::error::{PResult, Error, ErrorKind};
macro_rules! span {
($s:expr, $x:expr) => {{
let start_off = $s.span.start;
let val = $x;
let end_off = $s.prev_end_offset;
Spanned::new(Span {start: start_off, end: end_off}, val)
}}
}
macro_rules! try_span {
($s:expr, $x:expr) => {
span!($s, try!($x))
}
}
pub struct Parser<R: Iterator<Item = TokenAndSpan>> {
/// Our source of tokens.
/// Users can choose to read all the tokens up-front, or to read them lazily.
reader: Peekable<R>,
/// The current token.
token: Token,
/// The span of the current token.
span: Span,
/// Byte offset of the end of the most recently consumed token.
prev_end_offset: u32,
/// (XXX) Seems to indicate the current level of nesting when parsing expressions.
expression_level: u32,
}
impl<R: Iterator<Item = TokenAndSpan>> Parser<R> {
pub fn new(mut it: R) -> Parser<R> {
// TODO: handle missing tok gracefully.
let first_tok_and_pos = it.next().expect("missing first token");
debug!("first_tok_and_pos: {:?}", first_tok_and_pos);
Parser {
token: first_tok_and_pos.token,
span: first_tok_and_pos.span,
prev_end_offset: first_tok_and_pos.span.end,
reader: it.peekable(),
// In the Go code, the initial value of `exprLev` implicitly defaults to 0.
expression_level: 0,
}
}
/// Parse the tokens into a SourceFile (AST).
pub fn parse(mut self) -> PResult<ast::SourceFile> {
let package_name = try!(self.parse_package_clause());
let import_decls = try!(self.parse_import_decls());
let top_level_decls = try!(self.parse_top_level_decls());
Ok(ast::SourceFile {
package: package_name,
import_decls: import_decls,
top_level_decls: top_level_decls,
})
}
// === Utility functions ===
/// Build a parse error.
#[cold]
#[inline(never)]
fn err(&self, kind: ErrorKind) -> Error {
Error {
span: self.span,
kind: kind,
}
}
/// Advance the parser by one token.
fn bump(&mut self) {
trace!("current token: {:?}", self.token);
trace!("current span: {:?}", self.span);
trace!("bump");
let next = self.reader.next();
self.prev_end_offset = self.span.end;
if let Some(TokenAndSpan { span, token }) = next {
self.token = token;
self.span = span;
} else {
// XXX what span to set?
self.token = Token {
kind: TokenKind::Eof,
value: None,
};
}
}
/// Advance the parser by one token and return the bumped token.
fn bump_and_get(&mut self) -> Token {
// XXX(perf): clone; cloning is needed to let bump() see the previous token.
let old_token = self.token.clone();
self.bump();
old_token
}
/// Consume the next token, asserting its kind is equal to `expected`.
fn eat(&mut self, expected: TokenKind) -> PResult<()> {
if self.token.kind != expected {
return Err(self.err(ErrorKind::unexpected_token(vec![expected], self.token.clone())));
}
self.bump();
Ok(())
}
fn eat_and_get(&mut self, expected: TokenKind) -> PResult<(Token)> {
if self.token.kind != expected {
return Err(self.err(ErrorKind::unexpected_token(vec![expected], self.token.clone())));
}
Ok(self.bump_and_get())
}
// === parse_*() functions ===
/// Parse a package clause (e.g. `package main`).
fn parse_package_clause(&mut self) -> PResult<String> {
trace!("parse_package_clause");
try!(self.eat(TokenKind::Package));
let package_name = try!(self.parse_ident());
try!(self.eat(TokenKind::Semicolon));
Ok(package_name)
}
/// Parse any number of import declarations.
fn parse_import_decls(&mut self) -> PResult<Vec<Spanned<ast::ImportDecl>>> {
trace!("parse_import_decls");
let mut decls = Vec::new();
loop {
match self.token.kind {
TokenKind::Import => {
decls.push(try_span!(self, self.parse_import_decl()));
}
_ => return Ok(decls),
}
}
}
/// Parse an import declaration, which is made up of one or more import specs.
/// Simple example with a single spec: `import "fmt"`.
fn parse_import_decl(&mut self) -> PResult<ast::ImportDecl> {
trace!("parse_import_decl");
// Grammar:
//
// ```
// ImportDecl = "import" ( ImportSpec | "(" { ImportSpec ";" } ")" ) .
// ```
try!(self.eat(TokenKind::Import));
let mut specs = Vec::new();
match self.token.kind {
// Long import declaration.
TokenKind::LParen => {
self.bump();
// There may be multiple `ImportSpec`s in a single "long" import declaration.
loop {
match self.token.kind {
// XXX: Should we _know_ that import specs always start with a string
// literal? I'm not sure.
TokenKind::RParen => {
break;
}
_ => {
specs.push(try_span!(self, self.parse_import_spec()));
}
}
}
}
// Short import (single ImportSpec).
_ => specs.push(try_span!(self, self.parse_import_spec())),
}
try!(self.eat(TokenKind::Semicolon));
Ok(ast::ImportDecl { specs: specs })
}
/// Parse an "import spec".
fn parse_import_spec(&mut self) -> PResult<ast::ImportSpec> {
trace!("parse_import_spec");
// Grammar:
//
// ```
// ImportSpec = [ "." | PackageName ] ImportPath .
// ```
// Does this package spec define an alias?
let kind = match self.token.kind {
// Glob import.
TokenKind::Dot => {
self.bump();
ast::ImportKind::Glob
}
TokenKind::Ident => ast::ImportKind::Alias(self.bump_and_get().value.unwrap()),
_ => ast::ImportKind::Normal,
};
// The next token MUST be a string literal (interpreted or raw).
let path = try_span!(self, self.parse_string_lit());
Ok(ast::ImportSpec {
path: path,
kind: kind,
})
}
/// Parse any number of top-level declarations (see TopLevelDecl docs).
// Grammar:
//
// TopLevelDecl = Declaration | FunctionDecl | MethodDecl .
fn parse_top_level_decls(&mut self) -> PResult<Vec<ast::TopLevelDecl>> {
trace!("parse_top_level_decls");
let mut decls = Vec::new();
// FIXME: no loop + unfinished!
match self.token.kind {
// FunctionDecl
TokenKind::Func => {
let fd = try!(self.parse_func_decl());
decls.push(ast::TopLevelDecl::Func(fd));
}
_ => {
let e = ErrorKind::unexpected_token(vec![TokenKind::Func], self.token.clone());
return Err(self.err(e));
}
}
Ok(decls)
}
/// Parse a full function declaration (including signature, name, and block).
fn parse_func_decl(&mut self) -> PResult<ast::FuncDecl> {
trace!("parse_func_decl");
// Grammar:
// FunctionDecl = "func" FunctionName ( Function | Signature ) .
// FunctionName = identifier .
// Function = Signature FunctionBody .
// FunctionBody = Block .
try!(self.eat(TokenKind::Func));
let name = try_span!(self, self.parse_ident());
let signature = try!(self.parse_func_signature());
let body = match self.token.kind {
// This function has a body, parse it.
TokenKind::LBrace => Some(try!(self.parse_block())),
// No body.
_ => None,
};
try!(self.eat(TokenKind::Semicolon));
Ok(ast::FuncDecl {
name: name,
signature: signature,
body: body,
})
}
/// Parse a function _signature_ - i.e., just the parameter and result types of a func.
fn parse_func_signature(&mut self) -> PResult<ast::FuncSignature> {
trace!("parse_func_signature");
// Grammar:
//
// Signature = Parameters [ Result ] .
// Result = Parameters | Type .
//
// Example signature:
//
// (int, int, float64) (float64, *[]int)
//
// The parameters and the result of a function have a similar grammar,
// however there's a small difference. The Go spec says:
//
// "Parameter and result lists are always parenthesized except that if there is exactly one
// unnamed result it may be written as an unparenthesized type."
let parameters = try!(self.parse_func_params());
let result = match self.token.kind {
// An opening parenthesis! We can parse an output parameter list.
TokenKind::LParen => try!(self.parse_func_params()),
// Brace = no return type, but a body. We don't care about the body in this function.
// Semicolon = no return type and no body.
TokenKind::LBrace | TokenKind::Semicolon => ast::Parameters::empty(),
// Otherwise, a single, unnamed return type.
_ => ast::Parameters::from_single_type(try!(self.parse_type())),
};
Ok(ast::FuncSignature {
parameters: parameters,
result: result,
})
}
/// Parse function parameters, as defined by the Go grammar.
///
/// This may be used to parse the return types of a function if they are prefixed with a
/// parenthesis, and follow the same grammar as input parameters.
/// Parameters may be named or unnamed.
fn parse_func_params(&mut self) -> PResult<ast::Parameters> {
trace!("parse_func_params");
// Grammar:
//
// Parameters = "(" [ ParameterList [ "," ] ] ")" .
// ParameterList = ParameterDecl { "," ParameterDecl } .
// ParameterDecl = [ IdentifierList ] [ "..." ] Type .
try!(self.eat(TokenKind::LParen));
let mut decls = Vec::new();
// The parameter list is optional.
match self.token.kind {
TokenKind::Ident | TokenKind::Ellipsis => {
decls.push(try!(self.parse_parameter_decl()));
while let TokenKind::Comma = self.token.kind {
try!(self.eat(TokenKind::Comma));
decls.push(try!(self.parse_parameter_decl()));
}
}
_ => {}
}
try!(self.eat(TokenKind::RParen));
// XXX: do we _need_ Parameters to be a type by itself?
Ok(ast::Parameters { decls: decls })
}
/// Parse a "parameter decl".
fn parse_parameter_decl(&mut self) -> PResult<ast::ParameterDecl> {
trace!("parse_parameter_decl");
// Grammar:
// ParameterDecl = [ IdentifierList ] [ "..." ] Type .
let mut idents = Vec::new();
let mut variadic = false;
// The identifier list is optional.
if let TokenKind::Ident = self.token.kind {
// Grammar:
// IdentifierList = identifier { "," identifier } .
idents.push(try!(self.parse_ident()));
while let TokenKind::Comma = self.token.kind {
try!(self.eat(TokenKind::Comma));
idents.push(try!(self.parse_ident()));
}
}
// So is the ellipsis that indicates a variadic func.
if let TokenKind::Ellipsis = self.token.kind {
try!(self.eat(TokenKind::Ellipsis));
variadic = true;
}
// The type is mandatory.
let typ = try!(self.parse_type());
Ok(ast::ParameterDecl {
identifiers: idents,
typ: typ,
variadic: variadic,
})
}
/// Parse a single type (e.g. `[]string`).
// XXX: type declarations can be very complex; this function needs attention.
fn parse_type(&mut self) -> PResult<ast::Type> {
trace!("parse_type");
// Grammar:
//
// Type = TypeName | TypeLit | "(" Type ")" .
// TypeName = identifier | QualifiedIdent .
// TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
// SliceType | MapType | ChannelType .
// TypeName = a (potentially qualified with a module path) identifier
// TypeLit = more complex type, this is where it gets interesting
match self.token.kind {
// A Type may be surrounded in parentheses, in which case we simply eat the
// parentheses and recurse.
TokenKind::LParen => {
try!(self.eat(TokenKind::LParen));
let typ = try!(self.parse_type());
try!(self.eat(TokenKind::RParen));
Ok(typ)
}
// If a Type starts with an identifier, it can only be a TypeName.
TokenKind::Ident => {
let id = try!(self.parse_maybe_qualified_ident());
Ok(ast::Type::Plain(id))
}
_ => unimplemented!(),
}
}
fn parse_maybe_qualified_ident(&mut self) -> PResult<ast::MaybeQualifiedIdent> {
let part1 = try!(self.parse_ident());
let name;
let package;
match self.token.kind {
// This is a qualified identifier.
// XXX: should we move that to a new function?
// Qualified idents can only appear in:
// - types (that's what we're parsing)
// - operands.
TokenKind::Dot => {
// XXX: I don't like this pattern.
try!(self.eat(TokenKind::Dot));
let part2 = try!(self.parse_ident());
package = Some(part1);
name = part2;
}
// Not qualified? Doesn't matter.
_ => {
name = part1;
package = None;
}
}
Ok(ast::MaybeQualifiedIdent {
package: package,
name: name,
})
}
fn parse_block(&mut self) -> PResult<ast::Block> {
trace!("parse_block");
// Grammar:
// Block = "{" StatementList "}" .
// StatementList = { Statement ";" } .
try!(self.eat(TokenKind::LBrace));
let mut statements = Vec::new();
while self.token.kind.can_start_statement() {
statements.push(try!(self.parse_statement()));
try!(self.eat(TokenKind::Semicolon));
}
try!(self.eat(TokenKind::RBrace));
Ok(ast::Block(statements))
}
// XXX: needs thorough review.
fn parse_statement(&mut self) -> PResult<ast::Statement> {
trace!("parse_statement");
// Statement =
// Declaration | LabeledStmt | SimpleStmt |
// GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
// FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
// DeferStmt .
//
// SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment |
// ShortVarDecl .
use token::TokenKind::*;
Ok(match self.token.kind {
Type | Var | Const => try!(self.parse_decl_stmt()).into(),
Go => try!(self.parse_go_stmt()).into(),
Defer => try!(self.parse_defer_stmt()).into(),
Return => try!(self.parse_return_stmt()).into(),
If => try!(self.parse_if_stmt()).into(),
Switch => try!(self.parse_switch_stmt()).into(),
Select => try!(self.parse_select_stmt()).into(),
For => try!(self.parse_for_stmt()).into(),
Break => try!(self.parse_break_stmt()).into(),
Continue => try!(self.parse_continue_stmt()).into(),
Goto => try!(self.parse_goto_stmt()).into(),
Fallthrough => try!(self.parse_fallthrough_stmt()).into(),
LBrace => try!(self.parse_block()).into(),
RBrace => {
// a semicolon may be omitted before a closing "}"
ast::EmptyStmt.into()
}
// All simple statements start with something expression-like.
t if t.can_start_expr() => try!(self.parse_simple_stmt()).into(),
_ => panic!("unexpected token"),
})
}
fn parse_go_stmt(&mut self) -> PResult<ast::GoStmt> {
trace!("parse_go_stmt");
try!(self.eat(TokenKind::Go));
Ok(ast::GoStmt { call: try_span!(self, self.parse_expr()) })
}
fn parse_break_stmt(&mut self) -> PResult<ast::BreakStmt> {
trace!("parse_break_stmt");
try!(self.eat(TokenKind::Break));
let label = if self.token.kind == TokenKind::Semicolon {
None
} else {
Some(try_span!(self, self.parse_ident()))
};
Ok(ast::BreakStmt { label: label })
}
fn parse_continue_stmt(&mut self) -> PResult<ast::ContinueStmt> {
trace!("parse_continue_stmt");
try!(self.eat(TokenKind::Continue));
let label = if self.token.kind == TokenKind::Semicolon {
None
} else {
Some(try_span!(self, self.parse_ident()))
};
Ok(ast::ContinueStmt { label: label })
}
fn parse_goto_stmt(&mut self) -> PResult<ast::GotoStmt> {
trace!("parse_goto_stmt");
try!(self.eat(TokenKind::Goto));
Ok(ast::GotoStmt { label: try_span!(self, self.parse_ident()) })
}
fn parse_fallthrough_stmt(&mut self) -> PResult<ast::FallthroughStmt> {
trace!("parse_fallthrough_stmt");
try!(self.eat(TokenKind::Fallthrough));
Ok(ast::FallthroughStmt)
}
fn parse_defer_stmt(&mut self) -> PResult<ast::DeferStmt> {
trace!("parse_defer_stmt");
try!(self.eat(TokenKind::Defer));
Ok(ast::DeferStmt { call: try_span!(self, self.parse_expr()) })
}
fn parse_return_stmt(&mut self) -> PResult<ast::ReturnStmt> {
trace!("parse_return_stmt");
try!(self.eat(TokenKind::Return));
Ok(ast::ReturnStmt { expr: try_span!(self, self.parse_expr()) })
}
fn parse_if_stmt(&mut self) -> PResult<ast::IfStmt> {
// IfStmt = "if" [ SimpleStmt ";" ] Expression Block [ "else" ( IfStmt | Block ) ] .
trace!("parse_if_stmt");
try!(self.eat(TokenKind::If));
let stmt = try_span!(self, self.parse_simple_stmt());
let before_stmt;
let condition;
if self.token.kind == TokenKind::Semicolon {
// We have a complex if statment.
self.bump();
before_stmt = Some(stmt);
condition = try_span!(self, self.parse_expr());
} else {
// We have a simple if statment.
// What we just parsed must be an ExprStmt representing the condition.
if let ast::SimpleStmt::Expr(expr) = stmt.item {
condition = expr;
} else {
return Err(Error {
span: stmt.span,
kind: ErrorKind::other("invalid expression as if condition"),
});
}
before_stmt = None;
}
let block = try!(self.parse_block());
let opt_else = if self.token.kind == TokenKind::Else {
self.bump();
Some(Box::new(match self.token.kind {
TokenKind::LBrace => ast::Else::Block(try!(self.parse_block())),
TokenKind::If => ast::Else::If(try!(self.parse_if_stmt())),
_ => {
let expected = vec![TokenKind::LBrace, TokenKind::If];
return Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone())));
}
}))
} else {
None
};
Ok(ast::IfStmt {
before_stmt: before_stmt,
condition: condition,
block: block,
opt_else: opt_else,
})
}
fn parse_switch_stmt(&mut self) -> PResult<ast::SwitchStmt> {
trace!("parse_switch_stmt");
unimplemented!()
}
fn parse_select_stmt(&mut self) -> PResult<ast::SelectStmt> {
trace!("parse_select_stmt");
unimplemented!()
}
fn parse_for_stmt(&mut self) -> PResult<ast::ForStmt> {
// ForStmt = "for" [ Condition | ForClause | RangeClause ] Block .
// Condition = Expression .
//
// ForClause = [ InitStmt ] ";" [ Condition ] ";" [ PostStmt ] .
// InitStmt = SimpleStmt .
// PostStmt = SimpleStmt .
//
// RangeClause = [ ExpressionList "=" | IdentifierList ":=" ] "range" Expression .
trace!("parse_for_stmt");
try!(self.eat(TokenKind::For));
Ok(ast::ForStmt {
header: try!(self.parse_for_header()),
body: try!(self.parse_block()),
})
}
fn parse_for_header(&mut self) -> PResult<ast::ForHeader> {
trace!("parse_for_header");
unimplemented!()
}
fn expr_list_to_ident_list(&self,
exprs: &Vec<Spanned<ast::Expr>>)
-> PResult<Vec<Spanned<String>>> {
trace!("expr_list_to_ident_list");
// XXX: better errors
let mut idents = Vec::new();
use ast::{Expr, UnaryExpr, PrimaryExpr, Operand};
for expr in exprs {
if let Expr::Unary(UnaryExpr::Primary(x)) = expr.item.clone() {
if let PrimaryExpr::Operand(Operand::MaybeQualifiedIdent(mqident)) = *x {
if mqident.package.is_some() {
return Err(Error {
kind: ErrorKind::other("expected unqualified ident"),
span: expr.span,
});
}
idents.push(Spanned::new(expr.span, mqident.name));
continue;
}
}
// didn't successfully turn the expr into an ident
return Err(Error {
kind: ErrorKind::other("expected ident"),
span: expr.span,
});
}
Ok(idents)
}
fn parse_simple_stmt(&mut self) -> PResult<ast::SimpleStmt> {
// SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment |
// ShortVarDecl .
//
// EmptyStmt = .
// ExpressionStmt = Expression .
// SendStmt = Channel "<-" Expression .
// Channel = Expression .
// IncDecStmt = Expression ( "++" | "--" ) .
// Assignment = ExpressionList assign_op ExpressionList .
// assign_op = [ add_op | mul_op ] "=" .
//
// ShortVarDecl = IdentifierList ":=" ExpressionList .
trace!("parse_simple_stmt");
let exprs = try!(self.parse_expr_list());
if self.token.kind.is_assign_op() {
let op = ast::BinaryOperator::from_token_kind_assign_op(self.bump_and_get().kind);
return Ok(ast::SimpleStmt::Assignment(ast::Assignment {
lhs: exprs,
rhs: try!(self.parse_expr_list()),
op: op,
}));
}
if self.token.kind == TokenKind::ColonAssign {
let idents = try!(self.expr_list_to_ident_list(&exprs));
return Ok(ast::SimpleStmt::ShortVarDecl(ast::ShortVarDecl {
lhs: idents,
rhs: try!(self.parse_expr_list()),
}));
}
let expr;
// Now we have no possible SimpleStmt types left that start with a list of exprs.
if exprs.len() > 1 {
return Err(self.err(
ErrorKind::unexpected_token(vec![TokenKind::Assign], self.token.clone())
));
} else if exprs.len() == 1 {
// move exprs to prevent access later and avoid cloning
expr = exprs.into_iter().next().unwrap();
} else {
panic!("BUG");
}
match self.token.kind {
TokenKind::Arrow => {
self.bump();
Ok(ast::SimpleStmt::Send(ast::SendStmt {
channel: expr,
expr: try_span!(self, self.parse_expr()),
}))
}
TokenKind::Increment => {
self.bump();
Ok(ast::SimpleStmt::IncDec(ast::IncDecStmt {
expr: expr,
is_dec: false,
}))
}
TokenKind::Decrement => {
self.bump();
Ok(ast::SimpleStmt::IncDec(ast::IncDecStmt {
expr: expr,
is_dec: true,
}))
}
TokenKind::Semicolon => Ok(ast::SimpleStmt::Expr(expr)),
_ => {
let expected = vec![TokenKind::Arrow,
TokenKind::Increment,
TokenKind::Decrement,
TokenKind::Assign];
Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone())))
}
}
}
fn parse_decl_stmt(&mut self) -> PResult<ast::SimpleStmt> {
trace!("parse_decl_stmt");
unimplemented!()
}
// XXX: error msg
fn parse_expr(&mut self) -> PResult<ast::Expr> {
trace!("parse_expr");
self.parse_potential_binary_expr(0)
}
fn parse_expr_list(&mut self) -> PResult<Vec<Spanned<ast::Expr>>> {
// ExpressionList = Expression { "," Expression } .
trace!("parse_expr_list");
let mut res = Vec::new();
res.push(try_span!(self, self.parse_expr()));
while self.token.kind == TokenKind::Comma {
self.bump();
res.push(try_span!(self, self.parse_expr()));
}
Ok(res)
}
/// Parse a unary *expression*, which can be a primary expression OR a unary *operation*.
// XXX: too much repetition, could probably be shortened
fn parse_unary_expr(&mut self) -> PResult<ast::UnaryExpr> {
// UnaryExpr = PrimaryExpr | unary_op UnaryExpr .
trace!("parse_unary_expr");
match self.token.kind {
// kind: unary operator
TokenKind::Plus | TokenKind::Minus | TokenKind::Not | TokenKind::Caret |
TokenKind::And => {
let op = ast::UnaryOperator::from_token_kind(self.token.kind).expect("BUG");
self.bump();
let x = try_span!(self, self.parse_unary_expr());
Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation {
operator: op,
operand: Box::new(x),
}))
}
// channel receive operation
TokenKind::Arrow => {
self.bump();
let x = try_span!(self, self.parse_unary_expr());
Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation {
operator: ast::UnaryOperator::ChanReceive,
operand: Box::new(x),
}))
}
// deref expression - star op
TokenKind::Star => {
self.bump();
let x = try_span!(self, self.parse_unary_expr());
Ok(ast::UnaryExpr::UnaryOperation(ast::UnaryOperation {
operator: ast::UnaryOperator::Deref,
operand: Box::new(x),
}))
}
// No operator, this can only be a primary expression.
_ => {
let x = try!(self.parse_primary_expr());
Ok(ast::UnaryExpr::Primary(Box::new(x)))
}
}
}
fn parse_selector(&mut self, x: ast::PrimaryExpr) -> PResult<ast::SelectorExpr> {
// ~ "assert x is an expr or a type... and not a "raw type" such as
// [...]T".
// I have _no_ idea what the author meant by that.
let selector = try!(self.parse_ident());
// Here's how things look at this point:
//
// value.fieldOrMethod
// ^ ^
// | |
// | |
// `x` `selector`
//
// We had already parsed the value (`x`), encountered a dot, and
// immediately knew we had to look for an identifier - a plain
// identifier, which cannot be qualified. This identifier is
// `selector`.
Ok(ast::SelectorExpr {
operand: Box::new(x),
selector: selector,
})
}
fn parse_type_assertion(&mut self, x: ast::PrimaryExpr) -> PResult<ast::TypeAssertion> {
// So now `x` _has_ to be an expression, and not a _type_. According to
// the original Go source. Don't ask me!
// x.(T)
// ^
// |
// |
// left paren
try!(self.eat(TokenKind::LParen));
// XXX: left off spanning for now.
let typ;
// There's a catch. Type switches. Look at this code:
//
// someVal.(type)
//
// This is the _literal_ `type` keyword. Not a placeholder. A keyword.
// It indicates a special kind of switch that compares to types instead
// of values.
if self.token.kind == TokenKind::Type {
typ = None;
self.bump();
} else {
typ = Some(try!(self.parse_type()));
}
try!(self.eat(TokenKind::RParen));
Ok(ast::TypeAssertion {
expr: Box::new(x),
typ: typ,
})
}
// XXX: straight, unidiomatic port from Go source.
// Well... almost. I tried to clean up a bit.
// This method (and the corresponding smaller methods) is really complicated. It needs careful
// review, and a lot of testing.
fn parse_primary_expr(&mut self) -> PResult<ast::PrimaryExpr> {
trace!("parse_primary_expr");
// Parse the first part of the expression, which may be a literal, a (potentially
// qualified) identifier, a method expression (= `SomeType.MethodName` - returns a
// function), or any expression if it is parenthesized.
//
// Operand = Literal | OperandName | MethodExpr | "(" Expression ")" .
//
let mut x = ast::PrimaryExpr::Operand(try!(self.parse_operand()));
'L: loop {
match self.token.kind {
TokenKind::Dot => {
self.bump();
match self.token.kind {
TokenKind::Ident => {
// XXX: Selector ~= MethodExpr?...
x = ast::PrimaryExpr::SelectorExpr(try!(self.parse_selector(x)));
}
TokenKind::LParen => {
x = ast::PrimaryExpr::TypeAssertion(try!(self.parse_type_assertion(x)));
}
_ => {
// XXX: the Go parser signals the error and keeps going, here.
// XXX: needs better diagnostic to explain we were looking for a
// selector or a type assertion.
let expected = vec![TokenKind::Ident, TokenKind::LParen];
return Err(self.err(
ErrorKind::unexpected_token(expected, self.token.clone())
));
}
}
}
TokenKind::LBracket => {
// ~"x must be an expression, not a type"
x = try!(self.parse_index_or_slice(x));
}
TokenKind::LParen => {
// ~"x must be an expression or a type, but NOT a 'raw type'"...?
// `x(x)` could be `T(x)` (conversion) or `f(x)` (function call).
x = try!(self.parse_call_or_conversion(x));
}
TokenKind::LBrace => unimplemented!(),
_ => break 'L,
}
}
Ok(x)
}
// XXX XXX XXX: Straight, untested, stupid port from the Go source.
fn parse_operand(&mut self) -> PResult<ast::Operand> {
trace!("parse_operand");
let ret = match self.token.kind {
TokenKind::Ident => {
let id = try!(self.parse_maybe_qualified_ident());
ast::Operand::MaybeQualifiedIdent(id)
}
token_kind if token_kind.can_start_basic_lit() => {
let lit = try!(self.parse_basic_lit());
ast::Operand::Lit(ast::Literal::Basic(lit))
}
TokenKind::LParen => {
// "(" Expr ")"
//
// Skip past the LParen.
self.bump();
self.expression_level += 1;
let expr = try!(self.parse_expr());
self.expression_level -= 1;
try!(self.eat(TokenKind::RParen));
ast::Operand::Expr(expr)
}
TokenKind::Func => {
let fl = try!(self.parse_func_lit());
ast::Operand::Lit(ast::Literal::Func(fl))
}
_ => {
let method_expr = try!(self.parse_method_expr());
ast::Operand::MethodExpr(method_expr)
}
};
Ok(ret)
}
fn parse_method_expr(&mut self) -> PResult<ast::MethodExpr> {
unimplemented!()
}
fn parse_func_lit(&mut self) -> PResult<ast::FuncLit> {
Ok(ast::FuncLit {
signature: try!(self.parse_func_signature()),
body: try!(self.parse_block()),
})
}
fn parse_index_or_slice(&mut self, x: ast::PrimaryExpr) -> PResult<ast::PrimaryExpr> {
unimplemented!()
}
fn parse_call_or_conversion(&mut self, x: ast::PrimaryExpr) -> PResult<ast::PrimaryExpr> {
unimplemented!()
}
fn parse_basic_lit(&mut self) -> PResult<ast::BasicLit> {
// BasicLit = int_lit | float_lit | imaginary_lit | rune_lit | string_lit .
trace!("parse_basic_lit");
use token::TokenKind::*;
match self.token.kind {
Decimal | Octal | Hex => Ok(ast::BasicLit::Int(try!(self.parse_int_lit()))),
Str | StrRaw => Ok(ast::BasicLit::Str(try!(self.parse_string_lit()))),
Float => {
let value = self.bump_and_get()
.value
.expect("BUG: missing value in float literal");
Ok(ast::BasicLit::Float(try!(self.interpret_float_lit(&value[..],
"float literal"))))
}
Imaginary => {
let value = self.bump_and_get()
.value
.expect("BUG: missing value in imaginary literal");
assert!(value.chars().last().unwrap() == 'i',
"BUG: imaginary literal token does not end with i");
let value_ref = value.trim_right_matches('i');
Ok(ast::BasicLit::Imaginary(try!(self.interpret_float_lit(value_ref,
"imaginary literal"))))
}
Rune => Ok(ast::BasicLit::Rune(try!(self.parse_rune_lit()))),
_ => {
let expected = vec![Decimal, Octal, Hex, Float, Imaginary, Rune, Str, StrRaw];
return Err(self.err(ErrorKind::unexpected_token(expected, self.token.clone())));
}
}
}
fn parse_rune_lit(&mut self) -> PResult<char> {
// rune_lit = "'" ( unicode_value | byte_value ) "'" .
trace!("parse_rune_lit");
let value = try!(self.eat_and_get(TokenKind::Rune))
.value
.expect("BUG: missing value in rune literal");
let mut char_indices = value.char_indices().peekable();
let result;
let (_, c) = char_indices.next().unwrap();
if c == '\\' {
let &(_, pc) = char_indices.peek().expect("BUG: rune lit containing only \\");
// First check to see if we have a simple escape.
if let Some(escape_byte) = self.get_simple_escape(pc) {
char_indices.next();
result = escape_byte as char;
} else if pc == '\'' {
char_indices.next();
// \' is only valid in runes
result = '\'';
} else if pc == 'x' {
char_indices.next();
result = try!(self.interpret_hex_escape(&mut char_indices)) as char;
} else if pc == 'u' || pc == 'U' {
char_indices.next();
result = try!(self.interpret_unicode_escape(pc == 'U', &mut char_indices));
} else if pc.is_digit(8) {
result = try!(self.interpret_octal_escape(&mut char_indices)) as char;
} else {
let msg = format!("unknown escape sequence: {}", pc);
return Err(self.err(ErrorKind::other(msg)));
}
} else if c == '\n' {
return Err(self.err(ErrorKind::other("newline in rune literal")));
} else {
result = c;
}
if char_indices.next().is_none() {
Ok(result)
} else {
Err(self.err(ErrorKind::other("multiple characters in rune literal")))
}
}
/// Interpret the value of a float/imaginary literal and return the result as a BigRational.
/// If this method is being used to parse an imaginary lit, don't include the trailing `i`.
fn interpret_float_lit(&mut self, value: &str, token_name: &str) -> PResult<BigRational> {
// float_lit = decimals "." [ decimals ] [ exponent ] |
// decimals exponent |
// "." decimals [ exponent ] .
// decimals = decimal_digit { decimal_digit } .
// exponent = ( "e" | "E" ) [ "+" | "-" ] decimals .
trace!("interpret_float_lit");
let mut res = BigRational::from_integer(BigInt::from(0u8));
let mut chars = value.chars().peekable();
let mut parse_exponent = false;
let mut digits_after_dot = 0u32; // the number of digits after the dot we are
while let Some(c) = chars.next() {
if c == '.' {
digits_after_dot = 1;
} else if c == 'e' || c == 'E' {
parse_exponent = true;
break;
} else {
let digit = c.to_digit(10).expect("BUG: invalid char in float/imag lit");
let digit_value = BigRational::from_integer(BigInt::from(digit));
if digits_after_dot == 0 {
res = res * BigRational::from_integer(BigInt::from(10u8));
res = res + BigRational::from_integer(BigInt::from(digit));
} else {
res = res +
digit_value /
BigRational::from_integer(BigInt::from(10u32.pow(digits_after_dot)));
digits_after_dot += 1;
}
}
}
if parse_exponent {
let mut negative = false;
if let Some(&c) = chars.peek() {
if c == '+' {
chars.next();
} else if c == '-' {
negative = true;
chars.next();
}
} else {
// Empty exponent
return Err(self.err(ErrorKind::other(format!("malformed {} exponent",
token_name))));
}
let mut exponent = 0;
while let Some(c) = chars.next() {
exponent *= 10;
exponent += c.to_digit(10).expect("BUG: invalid char in float/imag lit exponent");
}
for _ in 0..exponent {
if negative {
res = res / BigRational::from_integer(BigInt::from(10u8));
} else {
res = res * BigRational::from_integer(BigInt::from(10u8));
}
}
}
Ok(res)
}
fn parse_int_lit(&mut self) -> PResult<BigInt> {
// int_lit = decimal_lit | octal_lit | hex_lit .
// decimal_lit = ( "1" … "9" ) { decimal_digit } .
// octal_lit = "0" { octal_digit } .
// hex_lit = "0" ( "x" | "X" ) hex_digit { hex_digit } .
trace!("parse_int_lit");
match self.token.kind {
TokenKind::Decimal => {
let value = self.bump_and_get().value.expect("BUG: missing value in decimal lit");
Ok(try!(self.interpret_int(&value[..], 10, "decimal literal")))
}
TokenKind::Octal => {
let value = self.bump_and_get().value.expect("BUG: missing value in octal lit");
assert_eq!(value.chars().next(), Some('0'));
Ok(try!(self.interpret_int(&value[1..], 8, "octal literal")))
}
TokenKind::Hex => {
let value = self.bump_and_get().value.expect("BUG: missing value in hex lit");
assert!(value.starts_with("0x") || value.starts_with("0X"));
Ok(try!(self.interpret_int(&value[2..], 16, "hex literal")))
}
_ => {
return Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Decimal,
TokenKind::Octal,
TokenKind::Hex],
self.token.clone())));
}
}
}
/// Interpret the value of an int literal and return the result as a BigInt, using the provided
/// base.
///
/// Use `token_name` to specify what type of literal this is, for error messages. To
/// parse an octal or hex literal, do not pass the `0` or `0x` prefixes.
fn interpret_int(&mut self, lit: &str, base: u32, token_name: &str) -> PResult<BigInt> {
trace!("interpret_int");
let mut res = BigInt::from(0u8);
for c in lit.chars() {
if let Some(d) = c.to_digit(base) {
res = res * BigInt::from(base);
res = res + BigInt::from(d);
} else {
let msg = format!("invalid character in {}: {}", token_name, c);
return Err(self.err(ErrorKind::other(msg)));
}
}
Ok(res)
}
// This is pretty much a straight port from the official Go source.
fn parse_potential_binary_expr(&mut self, prec1: i32) -> PResult<ast::Expr> {
// Grammar:
// Expression binary_op Expression
trace!("parse_potential_binary_expr");
let a = try_span!(self, self.parse_unary_expr());
let mut x = Spanned::new(a.span, ast::Expr::Unary(a.item));
loop {
let bin_op_kind = match ast::BinaryOperator::from_token_kind(self.token.kind) {
Some(x) => x,
// The current token is not a binary operator.
None => return Ok(x.item),
};
let precedence = bin_op_kind.precedence();
if precedence < prec1 {
return Ok(x.item);
}
self.bump();
let y = try_span!(self, self.parse_potential_binary_expr(precedence + 1));
let binop_span = Span {
start: x.span.start,
end: y.span.end,
};
x = Spanned::new(binop_span,
ast::Expr::Binary(ast::BinaryExpr {
lhs: Box::new(x),
op: bin_op_kind,
rhs: Box::new(y),
}));
}
}
/// Parse an identifier.
// XXX: come back later. String interning and all that.
fn parse_ident(&mut self) -> PResult<String> {
trace!("parse_ident");
match self.token.kind {
TokenKind::Ident => {
Ok(self.bump_and_get()
.value
.clone()
.expect("BUG: missing value in identifier token"))
}
_ => {
Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Ident],
self.token.clone())))
}
}
}
/// Parse a string literal, whether interpreted or raw.
/// This is useful because one will often expect a string literal without caring about its
/// kind.
fn parse_string_lit(&mut self) -> PResult<Vec<u8>> {
trace!("parse_string_lit");
// Grammar:
//
// ```
// string_lit = raw_string_lit | interpreted_string_lit .
// raw_string_lit = "`" { unicode_char | newline } "`" .
// interpreted_string_lit = `"` { unicode_value | byte_value } `"` .
// ```
match self.token.kind {
TokenKind::Str => {
// Interpret the string.
let raw_val = self.bump_and_get().value.expect("BUG: missing Str value");
Ok(try!(self.interpret_string_lit(raw_val)))
}
TokenKind::StrRaw => {
// Only interpreting that needs to be done is removing carriage returns.
let raw_val = self.bump_and_get().value.expect("BUG: missing StrRaw value");
let mut byte_vec = raw_val.into_bytes();
byte_vec.retain(|&c| c != b'\r');
Ok(byte_vec)
}
_ => {
Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Str, TokenKind::StrRaw],
self.token.clone())))
}
}
}
fn interpret_unicode_escape(&self,
long: bool,
chars: &mut Iterator<Item = (usize, char)>)
-> PResult<char> {
let num_digits = if long {
8
} else {
4
};
let mut value = 0u32;
for _ in 0..num_digits {
if let Some((_, c)) = chars.next() {
if let Some(number) = c.to_digit(16) {
value *= 16;
value += number;
} else {
let msg = format!("illegal character in unicode escape: '{}'", c);
return Err(self.err(ErrorKind::other(msg)));
}
} else {
let msg = "unexpected end of string in unicode escape";
return Err(self.err(ErrorKind::other(msg)));
}
}
return if let Some(value_char) = ::std::char::from_u32(value) {
Ok(value_char)
} else {
let msg = format!("escape sequence is invalid unicode codepoint: {:#x}", value);
Err(self.err(ErrorKind::other(msg)))
};
}
fn interpret_octal_escape(&self, chars: &mut Iterator<Item = (usize, char)>) -> PResult<u8> {
let mut value = 0u16;
for _ in 0..3 {
if let Some((_, c)) = chars.next() {
if let Some(number) = c.to_digit(8) {
value *= 8;
value += number as u16;
} else {
let msg = format!("illegal character in octal escape: '{}'", c);
return Err(self.err(ErrorKind::other(msg)));
}
} else {
let msg = "unexpected end of string in octal escape";
return Err(self.err(ErrorKind::other(msg)));
}
}
return if value > 255 {
let msg = format!("illegal octal escape value > 255: {}", value);
Err(self.err(ErrorKind::other(msg)))
} else {
Ok(value as u8)
};
}
fn interpret_hex_escape(&self, chars: &mut Iterator<Item = (usize, char)>) -> PResult<u8> {
let mut value = 0u8;
for _ in 0..2 {
if let Some((_, c)) = chars.next() {
if let Some(number) = c.to_digit(16) {
value *= 16;
value += number as u8;
} else {
let msg = format!("illegal character in hex escape: '{}'", c);
return Err(self.err(ErrorKind::other(msg)));
}
} else {
let msg = "unexpected end of string in hex escape";
return Err(self.err(ErrorKind::other(msg)));
}
}
Ok(value)
}
fn get_simple_escape(&self, c: char) -> Option<u8> {
// The escapes are roughly sorted by most common first.
// XXX: actually find out exact ordering
// XXX(perf): .find() on a static array _will_ be slower than a match.
let simple_escapes = [('\\', b'\\'),
('n', b'\n'),
('t', b'\t'),
('v', b'\x0b'),
('r', b'\r'),
('b', b'\x08'),
('f', b'\x0c'),
('a', b'\x07')];
return if let Some(escape) = simple_escapes.iter().find(|escape| escape.0 == c) {
Some(escape.1)
} else {
None
};
}
/// Interpret a string literal, converting escape patterns to bytes.
/// Note that it returns a Vec<u8> rather than a String. This is because Go string literals
/// are allowed to contain invalid ASCII/UTF-8 through the use of octal and hex escapes.
fn interpret_string_lit(&mut self, lit: String) -> PResult<Vec<u8>> {
let mut result = Vec::new();
let mut char_indices = lit.char_indices().peekable();
while let Some((offset, c)) = char_indices.next() {
if c == '\\' {
// A string literal with a value ending with \ shouldn't get past the lexer.
let &(_, pc) = char_indices.peek()
.expect("unexpected end of string: this is a bug!");
// First check to see if we have a simple escape.
if let Some(escape_byte) = self.get_simple_escape(pc) {
char_indices.next();
result.push(escape_byte);
} else if pc == '"' {
char_indices.next();
// \" is only valid in strings
result.push(b'"');
} else if pc == 'x' {
char_indices.next();
let byte = try!(self.interpret_hex_escape(&mut char_indices));
result.push(byte);
} else if pc == 'u' || pc == 'U' {
char_indices.next();
let value_char = try!(self.interpret_unicode_escape(pc == 'U',
&mut char_indices));
let mut tmp = String::with_capacity(4);
tmp.push(value_char);
result.extend_from_slice(tmp.as_bytes());
} else if pc.is_digit(8) {
let byte = try!(self.interpret_octal_escape(&mut char_indices));
result.push(byte);
} else {
let msg = format!("unknown escape sequence: {}", pc);
return Err(self.err(ErrorKind::other(msg)));
}
} else if c == '\n' {
let msg = format!("newline in string");
return Err(self.err(ErrorKind::other(msg)));
} else {
let orig_str = &lit[offset..offset + c.len_utf8()];
result.extend_from_slice(orig_str.as_bytes());
}
}
Ok(result)
}
}
pub fn parse_tokens(tokens: Vec<TokenAndSpan>) -> ast::SourceFile {
let parser = Parser::new(tokens.into_iter());
// XXX: unwrapping
parser.parse().unwrap()
}
================================================
FILE: src/parser/test.rs
================================================
use super::*;
use std::str::FromStr;
use lexer;
use ast;
use num::bigint::BigInt;
use num::BigRational;
// String literals
fn assert_interpret_string_eq(lit: &str, expect: Vec<u8>) {
let tokens = lexer::tokenize(format!("\"{}\"", lit).as_ref());
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
let got = p.interpret_string_lit(lit.to_owned()).unwrap();
assert_eq!(expect, got);
}
fn assert_interpret_string_valid(lit: &str) {
let tokens = lexer::tokenize(format!("\"{}\"", lit).as_ref());
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
p.interpret_string_lit(lit.to_owned()).unwrap();
}
#[test]
fn test_interpret_strings() {
let string_tests = [("hello", "hello"),
("newline \\n", "newline \n"),
("\\\"", "\""),
("日本語", "日本語"),
("\\u65e5本\\U00008a9e", "日本語"),
("\\u65e5\\u672c\\u8a9e", "日本語"),
("\\U000065e5\\U0000672c\\U00008a9e", "日本語"),
("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e", "日本語"),
("\\150", "h")];
for t in &string_tests {
assert_interpret_string_eq(t.0, t.1.into());
}
assert_interpret_string_eq("\\xff\\u00FF", vec![255, 195, 191]);
}
#[test]
#[should_panic]
fn test_interpret_string_illegal_surrogate_half() {
assert_interpret_string_valid("\\uD800");
}
#[test]
#[should_panic]
fn test_interpret_string_invalid_codepoint() {
assert_interpret_string_valid("\\U00110000");
}
// Rune literals
fn assert_interpret_rune_eq(lit: &str, expect: char) {
let tokens = lexer::tokenize(format!("'{}'", lit).as_ref());
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
let got = p.parse_rune_lit().unwrap();
assert_eq!(expect, got);
}
fn assert_interpret_rune_valid(lit: &str) {
let tokens = lexer::tokenize(format!("'{}'", lit).as_ref());
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
p.parse_rune_lit().unwrap();
}
#[test]
fn test_interpret_runes() {
let rune_tests = [("a", 'a'),
("ä", 'ä'),
("本", '本'),
("\\t", '\t'),
("\\000", '\0'),
("\\007", '\x07'),
("\\377", '\u{00ff}'),
("\\x07", '\x07'),
("\\xff", '\u{00ff}'),
("\\u12e4", '\u{12e4}'),
("\\U00101234", '\u{101234}'),
("\\'", '\'')];
for &(lit, expect) in &rune_tests {
assert_interpret_rune_eq(lit, expect);
}
}
#[test]
#[should_panic]
fn test_interpret_rune_too_many_characters() {
assert_interpret_rune_valid("aa");
}
#[test]
#[should_panic]
fn test_interpret_rune_too_few_hex_digits() {
assert_interpret_rune_valid("\\xa");
}
#[test]
#[should_panic]
fn test_interpret_rune_too_few_octal_digits() {
assert_interpret_rune_valid("\\0");
}
#[test]
#[should_panic]
fn test_interpret_rune_surrogate_half() {
assert_interpret_rune_valid("\\uDFFF");
}
#[test]
#[should_panic]
fn test_interpret_rune_invalid_codepoint() {
assert_interpret_rune_valid("\\u00110000");
}
// Int literals
fn assert_interpret_int_eq(lit: &str, expect: BigInt) {
let tokens = lexer::tokenize(lit);
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
let got = p.parse_int_lit().unwrap();
assert_eq!(expect, got);
}
#[test]
fn test_interpret_ints() {
assert_interpret_int_eq("42", BigInt::from(42));
assert_interpret_int_eq("0600", BigInt::from(0o600));
assert_interpret_int_eq("0xBadFace", BigInt::from(0xbadface));
assert_interpret_int_eq("170141183460469231731687303715884105727",
BigInt::from_str("170141183460469231731687303715884105727").unwrap());
}
// Float/imaginary literals
fn assert_interpret_float_eq(lit: &str, expect: BigRational) {
let tokens = lexer::tokenize(format!("{}", lit).as_ref());
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
let got = p.parse_basic_lit().unwrap();
if let ast::BasicLit::Float(val) = got {
assert_eq!(expect, val);
} else {
panic!(format!("expected float basic lit, found {:?}", got));
}
}
fn assert_interpret_imaginary_eq(lit: &str, expect: BigRational) {
let tokens = lexer::tokenize(lit);
assert_eq!(tokens.len(), 1);
let mut p = Parser::new(tokens.into_iter());
let got = p.parse_basic_lit().unwrap();
if let ast::BasicLit::Imaginary(val) = got {
assert_eq!(expect, val);
} else {
panic!(format!("expected imaginary basic lit, found {:?}", got));
}
}
fn bigrat_from_int(value: u64) -> BigRational {
BigRational::from_integer(BigInt::from(value))
}
fn bigrat_from_ints(numerator: u64, denominator: u64) -> BigRational {
BigRational::from_integer(BigInt::from(numerator)) /
BigRational::from_integer(BigInt::from(denominator))
}
#[test]
fn test_interpret_floats() {
let float_tests = [("13e0", bigrat_from_int(13)),
("13e4", bigrat_from_int(130000)),
("13E4", bigrat_from_int(130000)),
("13e+4", bigrat_from_int(130000)),
("130000e-4", bigrat_from_int(13)),
("1.5", bigrat_from_ints(3, 2)),
("0.", bigrat_from_int(0)),
("72.40", bigrat_from_ints(724, 10)),
("072.40", bigrat_from_ints(724, 10)),
("2.71828", bigrat_from_ints(271828, 100000)),
("1.e+0", bigrat_from_int(1)),
("6.67428e-11", bigrat_from_ints(667428, 10000000000000000)),
("1E6", bigrat_from_int(1000000)),
(".25", bigrat_from_ints(25, 100)),
(".12345E+5", bigrat_from_int(12345))];
for t in &float_tests {
assert_interpret_float_eq(t.0, t.1.clone());
}
}
#[test]
fn test_interpret_imaginaries() {
let float_tests = [("0i", bigrat_from_int(0)),
("011i", bigrat_from_int(11)),
("0.i", bigrat_from_int(0)),
("2.71828i", bigrat_from_ints(271828, 100000)),
("1.e+0i", bigrat_from_int(1)),
("6.67428e-11i", bigrat_from_ints(667428, 10000000000000000)),
("1E6i", bigrat_from_int(1000000)),
(".25i", bigrat_from_ints(25, 100)),
(".12345E+5i", bigrat_from_int(12345))];
for t in &float_tests {
assert_interpret_imaginary_eq(t.0, t.1.clone());
}
}
================================================
FILE: src/pos.rs
================================================
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Position {
/// 1-indexed row.
pub row: usize,
/// 1-indexed column.
pub column: usize,
}
impl Position {
pub fn start() -> Position {
Position {
row: 1,
column: 1,
}
}
}
================================================
FILE: src/token.rs
================================================
use std::fmt;
use self::TokenKind::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct TokenAndSpan {
pub token: Token,
pub span: Span,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Span {
pub start: u32,
pub end: u32,
}
pub trait Spanner {
fn span(&self) -> Span;
}
impl Spanner for Span {
fn span(&self) -> Span {
*self
}
}
/// Returns a new span from the start of the first element to the end of the last element.
/// This is useful in cases like the following:
/// ```
/// var a, b, c, d, e, f, g int
/// ```
/// We have `Vec<Spanned<Ident>>` for all the variable names, so we can get a span of the whole list.
///
/// If the vector is empty, this returns a default `Span`.
impl<T: Spanner> Spanner for Vec<T> {
fn span(&self) -> Span {
if self.is_empty() {
// XXX
return Span { start: 0, end: 0 };
}
Span {
start: self.first().unwrap().span().start,
end: self.last().unwrap().span().end,
}
}
}
/// Simply get the span embedded in this `Spanned`.
impl<T: fmt::Debug + Clone + PartialEq + Eq> Spanner for Spanned<T> {
fn span(&self) -> Span {
self.span
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Spanned<T: fmt::Debug + Clone + PartialEq + Eq> {
pub span: Span,
pub item: T,
}
impl<T: fmt::Debug + Clone + PartialEq + Eq> Spanned<T> {
pub fn new(span: Span, item: T) -> Spanned<T> {
Spanned {
span: span,
item: item,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Token {
pub kind: TokenKind,
pub value: Option<String>,
}
impl fmt::Display for Token {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// If the token contains a value, display it.
match self.value {
Some(ref v) => write!(f, "{}({})", self, v),
None => write!(f, "{}", self),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TokenKind {
/// Identifier.
Ident,
// Delimiters.
/// (
LParen,
/// )
RParen,
/// [
LBracket,
/// ]
RBracket,
/// {
LBrace,
/// }
RBrace,
// Literals.
/// Decimal integer literal.
Decimal,
/// Octal integer literal.
Octal,
/// Hex integer literal.
Hex,
/// Floating-point literal.
Float,
/// Imaginary literal (e.g. `6.67428e-11i`).
Imaginary,
/// Rune literal (e.g. `'本'`, `'\U00101234'`).
Rune,
/// Interpreted string literal.
Str,
/// Raw string literal.
StrRaw,
// Keywords.
Break,
Case,
Chan,
Const,
Continue,
Default,
Defer,
Else,
Fallthrough,
For,
Func,
Go,
Goto,
If,
Import,
Interface,
Map,
Package,
Range,
Return,
Select,
Struct,
Switch,
Type,
Var,
// Operators.
/// +
Plus,
/// -
Minus,
/// *
Star,
/// /
Slash,
/// %
Percent,
/// &
And,
/// |
Or,
/// ^
Caret,
/// <<
Lshift,
/// >>
Rshift,
/// &^
BitClear,
/// &&
AndAnd,
/// ||
OrOr,
/// ==
Equals,
/// !=
NotEqual,
/// <
LessThan,
/// >
GreaterThan,
/// <=
LessThanOrEqual,
/// >=
GreaterThanOrEqual,
/// ++
Increment,
/// --
Decrement,
/// +=
PlusAssign,
/// -=
MinusAssign,
/// *=
StarAssign,
/// /=
SlashAssign,
/// %=
PercentAssign,
/// &=
AndAssign,
/// |=
OrAssign,
/// ^=
CaretAssign,
/// <<=
LshiftAssign,
/// >>=
RshiftAssign,
/// &^=
BitClearAssign,
/// !
Not,
/// =
Assign,
/// :=
ColonAssign,
/// <-
Arrow,
// Misc.
/// ...
Ellipsis,
/// ,
Comma,
/// .
Dot,
/// ;
Semicolon,
/// :
Colon,
/// End of file
Eof,
}
impl fmt::Display for TokenKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// We're using the derived Debug impl for simplicity.
// It displays the name of each variant as written in the enum declaration.
fmt::Debug::fmt(self, f)
}
}
impl TokenKind {
pub fn precedence(self) -> i32 {
// Precedence Operator
// 5 * / % << >> & &^
// 4 + - | ^
// 3 == != < <= > >=
// 2 &&
// 1 ||
match self {
Star | Slash | Percent | Lshift | Rshift | And | BitClear => 5,
Plus | Minus | Or | Caret => 4,
Equals | NotEqual | LessThan | LessThanOrEqual | GreaterThan | GreaterThanOrEqual => 3,
AndAnd => 2,
OrOr => 1,
_ => panic!("BUG: calling .precedence() on a token which is not a binary operator"),
}
}
pub fn is_ident(self) -> bool {
self == Ident
}
pub fn is_unary_op(self) -> bool {
// unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
match self {
Plus | Minus | Not | Caret | Star | And | Arrow => true,
_ => false,
}
}
pub fn is_assign_op(self) -> bool {
// assign_op = [ add_op | mul_op ] "=" .
// add_op = "+" | "-" | "|" | "^" .
// mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .
match self {
Assign | PlusAssign | MinusAssign | OrAssign | CaretAssign | StarAssign |
SlashAssign | PercentAssign | LshiftAssign | RshiftAssign | AndAssign |
BitClearAssign => true,
_ => false,
}
}
pub fn is_literal(self) -> bool {
match self {
Str | StrRaw | Decimal | Octal | Hex | Float | Imaginary | Rune => true,
_ => false,
}
}
pub fn can_start_statement(self) -> bool {
// Grammar:
// Statement =
// Declaration | LabeledStmt | SimpleStmt |
// GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
// FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
// DeferStmt .
//
// SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment |
// ShortVarDecl .
if self.can_start_decl() || self.can_start_labeled_stmt() ||
self.can_start_simple_stmt() || self.can_start_go_stmt() ||
self.can_start_block() {
return true;
}
match self {
Return | Break | Continue | Goto | Fallthrough | If |
// XXX/TODO: make sure that this is correct.
Switch | Select | For | Defer => true,
_ => false,
}
}
pub fn can_start_block(self) -> bool {
self == LBrace
}
pub fn can_start_return_stmt(self) -> bool {
self == Return
}
pub fn can_start_labeled_stmt(self) -> bool {
// LabeledStmt = Label ":" Statement .
// Label = identifier .
self.is_ident()
}
pub fn can_start_go_stmt(self) -> bool {
self == Go
}
pub fn can_start_decl(self) -> bool {
trace!("can_start_decl");
// Declaration = ConstDecl | TypeDecl | VarDecl .
self == Const || self == Type || self == Var
}
pub fn can_start_simple_stmt(self) -> bool {
self == Semicolon || self.can_start_expr() || self.can_start_send_stmt() ||
self.can_start_inc_dec_stmt() || self.can_start_assignment() ||
self.can_start_short_var_decl()
}
pub fn can_start_expr(self) -> bool {
// Expression = UnaryExpr | Expression binary_op Expression .
// UnaryExpr = PrimaryExpr | unary_op UnaryExpr .
//
// binary_op = "||" | "&&" | rel_op | add_op | mul_op .
// rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" .
// add_op = "+" | "-" | "|" | "^" .
// mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .
//
// unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
//
//
// PrimaryExpr =
// Operand |
// Conversion |
// PrimaryExpr Selector |
// PrimaryExpr Index |
// PrimaryExpr Slice |
// PrimaryExpr TypeAssertion |
// PrimaryExpr Arguments .
//
// Selector = "." identifier .
// Index = "[" Expression "]" .
// Slice = "[" ( [ Expression ] ":" [ Expression ] ) |
// ( [ Expression ] ":" Expression ":" Expression )
// "]" .
// TypeAssertion = "." "(" Type ")" .
// Arguments = "(" [ ( ExpressionList | Type [ "," ExpressionList ] ) [ "..." ] [ ","
// ] ] ")" .
//
// Conversion = Type "(" Expression [ "," ] ")" .
//
// MethodExpr = ReceiverType "." MethodName .
// ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
// XXX/TODO: review this code - critical.
self.can_start_unary_expr()
}
pub fn can_start_unary_expr(self) -> bool {
self.can_start_primary_expr() || self.is_unary_op()
}
pub fn can_start_primary_expr(self) -> bool {
self.can_start_operand() || self.can_start_conversion()
}
pub fn can_start_operand(self) -> bool {
// Operand = Literal | OperandName | MethodExpr | "(" Expression ")" .
// OperandName = identifier | QualifiedIdent.
// MethodExpr = ReceiverType "." MethodName .
// ReceiverType = TypeName | "(" "*" TypeName ")" | "(" ReceiverType ")" .
//
// QualifiedIdent starts with an identifier.
// So does MethodExpr.
self.can_start_lit() || self.is_ident() || self == LParen
}
pub fn can_start_conversion(self) -> bool {
self.can_start_type()
}
pub fn can_start_type(self) -> bool {
// Type = TypeName | TypeLit | "(" Type ")" .
// TypeName = identifier | QualifiedIdent .
// TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
// SliceType | MapType | ChannelType .
self.is_ident() || self.can_start_type_lit() || self == LParen
}
pub fn can_start_type_lit(self) -> bool {
// TypeLit = ArrayType | StructType | PointerType | FunctionType | InterfaceType |
// SliceType | MapType | ChannelType .
self.can_start_array_type() || self.can_start_struct_type() ||
self.can_start_pointer_type() || self.can_start_func_type() ||
self.can_start_interface_type() || self.can_start_slice_type() ||
self.can_start_map_type() || self.can_start_chan_type()
}
pub fn can_start_pointer_type(self) -> bool {
self == Star
}
pub fn can_start_func_type(self) -> bool {
// FunctionType = "func" Signature .
self == Func
}
pub fn can_start_interface_type(self) -> bool {
// InterfaceType = "interface" "{" { MethodSpec ";" } "}" .
self == Interface
}
pub fn can_start_chan_type(self) -> bool {
// ChannelType = ( "chan" | "chan" "<-" | "<-" "chan" ) ElementType .
self == Chan || self == Arrow
}
pub fn can_start_lit(self) -> bool {
// Literal = BasicLit | CompositeLit | FunctionLit .
// BasicLit = int_lit | float_lit | imaginary_lit | rune_lit | string_lit .
self.can_start_basic_lit() || self.can_start_composite_lit() || self.can_start_func_lit()
}
pub fn can_start_basic_lit(self) -> bool {
self.is_literal()
}
pub fn can_start_composite_lit(self) -> bool {
// CompositeLit = LiteralType LiteralValue .
self.can_start_lit_type()
}
pub fn can_start_lit_type(self) -> bool {
// LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
// SliceType | MapType | TypeName .
self.can_start_struct_type() || self.can_start_array_type() || self == RBracket ||
self.can_start_slice_type() || self.can_start_map_type() || self.is_ident()
}
pub fn can_start_func_lit(self) -> bool {
// FunctionLit = "func" Function .
self == Func
}
pub fn can_start_struct_type(self) -> bool {
self == Struct
}
pub fn can_start_array_type(self) -> bool {
self == RBracket
}
pub fn can_start_slice_type(self) -> bool {
self == RBracket
}
pub fn can_start_map_type(self) -> bool {
self == Map
}
pub fn can_start_send_stmt(self) -> bool {
// SendStmt = Channel "<-" Expression .
// Channel = Expression .
self.can_start_expr()
}
pub fn can_start_inc_dec_stmt(self) -> bool {
// IncDecStmt = Expression ( "++" | "--" ) .
self.can_start_expr()
}
pub fn can_start_assignment(self) -> bool {
// Assignment = ExpressionList assign_op ExpressionList .
// ExpressionList = Expression { "," Expression } .
self.can_start_expr()
}
pub fn can_start_short_var_decl(self) -> bool {
// ShortVarDecl = IdentifierList ":=" ExpressionList .
// IdentifierList = identifier { "," identifier } .
self.is_ident()
}
}
================================================
FILE: tests/data/pass/arithConst_ssa.go
================================================
package main
import "fmt"
//go:noinline
func add_uint64_0_ssa(a uint64) uint64 {
return a + 0
}
//go:noinline
func add_0_uint64_ssa(a uint64) uint64 {
return 0 + a
}
//go:noinline
func add_uint64_1_ssa(a uint64) uint64 {
return a + 1
}
//go:noinline
func add_1_uint64_ssa(a uint64) uint64 {
return 1 + a
}
//go:noinline
func add_uint64_4294967296_ssa(a uint64) uint64 {
return a + 4294967296
}
//go:noinline
func add_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 + a
}
//go:noinline
func add_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a + 18446744073709551615
}
//go:noinline
func add_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 + a
}
//go:noinline
func sub_uint64_0_ssa(a uint64) uint64 {
return a - 0
}
//go:noinline
func sub_0_uint64_ssa(a uint64) uint64 {
return 0 - a
}
//go:noinline
func sub_uint64_1_ssa(a uint64) uint64 {
return a - 1
}
//go:noinline
func sub_1_uint64_ssa(a uint64) uint64 {
return 1 - a
}
//go:noinline
func sub_uint64_4294967296_ssa(a uint64) uint64 {
return a - 4294967296
}
//go:noinline
func sub_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 - a
}
//go:noinline
func sub_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a - 18446744073709551615
}
//go:noinline
func sub_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 - a
}
//go:noinline
func div_0_uint64_ssa(a uint64) uint64 {
return 0 / a
}
//go:noinline
func div_uint64_1_ssa(a uint64) uint64 {
return a / 1
}
//go:noinline
func div_1_uint64_ssa(a uint64) uint64 {
return 1 / a
}
//go:noinline
func div_uint64_4294967296_ssa(a uint64) uint64 {
return a / 4294967296
}
//go:noinline
func div_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 / a
}
//go:noinline
func div_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a / 18446744073709551615
}
//go:noinline
func div_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 / a
}
//go:noinline
func mul_uint64_0_ssa(a uint64) uint64 {
return a * 0
}
//go:noinline
func mul_0_uint64_ssa(a uint64) uint64 {
return 0 * a
}
//go:noinline
func mul_uint64_1_ssa(a uint64) uint64 {
return a * 1
}
//go:noinline
func mul_1_uint64_ssa(a uint64) uint64 {
return 1 * a
}
//go:noinline
func mul_uint64_4294967296_ssa(a uint64) uint64 {
return a * 4294967296
}
//go:noinline
func mul_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 * a
}
//go:noinline
func mul_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a * 18446744073709551615
}
//go:noinline
func mul_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 * a
}
//go:noinline
func lsh_uint64_0_ssa(a uint64) uint64 {
return a << 0
}
//go:noinline
func lsh_0_uint64_ssa(a uint64) uint64 {
return 0 << a
}
//go:noinline
func lsh_uint64_1_ssa(a uint64) uint64 {
return a << 1
}
//go:noinline
func lsh_1_uint64_ssa(a uint64) uint64 {
return 1 << a
}
//go:noinline
func lsh_uint64_4294967296_ssa(a uint64) uint64 {
return a << 4294967296
}
//go:noinline
func lsh_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 << a
}
//go:noinline
func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a << 18446744073709551615
}
//go:noinline
func lsh_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 << a
}
//go:noinline
func rsh_uint64_0_ssa(a uint64) uint64 {
return a >> 0
}
//go:noinline
func rsh_0_uint64_ssa(a uint64) uint64 {
return 0 >> a
}
//go:noinline
func rsh_uint64_1_ssa(a uint64) uint64 {
return a >> 1
}
//go:noinline
func rsh_1_uint64_ssa(a uint64) uint64 {
return 1 >> a
}
//go:noinline
func rsh_uint64_4294967296_ssa(a uint64) uint64 {
return a >> 4294967296
}
//go:noinline
func rsh_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 >> a
}
//go:noinline
func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a >> 18446744073709551615
}
//go:noinline
func rsh_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 >> a
}
//go:noinline
func mod_0_uint64_ssa(a uint64) uint64 {
return 0 % a
}
//go:noinline
func mod_uint64_1_ssa(a uint64) uint64 {
return a % 1
}
//go:noinline
func mod_1_uint64_ssa(a uint64) uint64 {
return 1 % a
}
//go:noinline
func mod_uint64_4294967296_ssa(a uint64) uint64 {
return a % 4294967296
}
//go:noinline
func mod_4294967296_uint64_ssa(a uint64) uint64 {
return 4294967296 % a
}
//go:noinline
func mod_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a % 18446744073709551615
}
//go:noinline
func mod_18446744073709551615_uint64_ssa(a uint64) uint64 {
return 18446744073709551615 % a
}
//go:noinline
func add_int64_Neg9223372036854775808_ssa(a int64) int64 {
return a + -9223372036854775808
}
//go:noinline
func add_Neg9223372036854775808_int64_ssa(a int64) int64 {
return -9223372036854775808 + a
}
//go:noinline
func add_int64_Neg9223372036854775807_ssa(a int64) int64 {
return a + -9223372036854775807
}
//go:noinline
func add_Neg9223372036854775807_int64_ssa(a int64) int64 {
return -9223372036854775807 + a
}
//go:noinline
func add_int64_Neg4294967296_ssa(a int64) int64 {
return a + -4294967296
}
//go:noinline
func add_Neg4294967296_int64_ssa(a int64) int64 {
return -4294967296 + a
}
//go:noinline
func add_int64_Neg1_ssa(a int64) int64 {
return a + -1
}
//go:noinline
func add_Neg1_int64_ssa(a int64) int64 {
return -1 + a
}
//go:noinline
func add_int64_0_ssa(a int64) int64 {
return a + 0
}
//go:noinline
func add_0_int64_ssa(a int64) int64 {
return 0 + a
}
//go:noinline
func add_int64_1_ssa(a int64) int64 {
return a + 1
}
//go:noinline
func add_1_int64_ssa(a int64) int64 {
return 1 + a
}
//go:noinline
func add_int64_4294967296_ssa(a int64) int64 {
return a + 4294967296
}
//go:noinline
func add_4294967296_int64_ssa(a int64) int64 {
return 4294967296 + a
}
//go:noinline
func add_int64_9223372036854775806_ssa(a int64) int64 {
return a + 9223372036854775806
}
//go:noinline
func add_9223372036854775806_int64_ssa(a int64) int64 {
return 9223372036854775806 + a
}
//go:noinline
func add_int64_9223372036854775807_ssa(a int64) int64 {
return a + 9223372036854775807
}
//go:noinline
func add_9223372036854775807_int64_ssa(a int64) int64 {
return 9223372036854775807 + a
}
//go:noinline
func sub_int64_Neg9223372036854775808_ssa(a int64) int64 {
return a - -9223372036854775808
}
//go:noinline
func sub_Neg9223372036854775808_int64_ssa(a int64) int64 {
return -9223372036854775808 - a
}
//go:noinline
func sub_int64_Neg9223372036854775807_ssa(a int64) int64 {
return a - -9223372036854775807
}
//go:noinline
func sub_Neg9223372036854775807_int64_ssa(a int64) int64 {
return -9223372036854775807 - a
}
//go:noinline
func sub_int64_Neg4294967296_ssa(a int64) int64 {
return a - -4294967296
}
//go:noinline
func sub_Neg4294967296_int64_ssa(a int64) int64 {
return -4294967296 - a
}
//go:noinline
func sub_int64_Neg1_ssa(a int64) int64 {
return a - -1
}
//go:noinline
func sub_Neg1_int64_ssa(a int64) int64 {
return -1 - a
}
//go:noinline
func sub_int64_0_ssa(a int64) int64 {
return a - 0
}
//go:noinline
func sub_0_int64_ssa(a int64) int64 {
return 0 - a
}
//go:noinline
func sub_int64_1_ssa(a int64) int64 {
return a - 1
}
//go:noinline
func sub_1_int64_ssa(a int64) int64 {
return 1 - a
}
//go:noinline
func sub_int64_4294967296_ssa(a int64) int64 {
return a - 4294967296
}
//go:noinline
func sub_4294967296_int64_ssa(a int64) int64 {
return 4294967296 - a
}
//go:noinline
func sub_int64_9223372036854775806_ssa(a int64) int64 {
return a - 9223372036854775806
}
//go:noinline
func sub_9223372036854775806_int64_ssa(a int64) int64 {
return 9223372036854775806 - a
}
//go:noinline
func sub_int64_9223372036854775807_ssa(a int64) int64 {
return a - 9223372036854775807
}
//go:noinline
func sub_9223372036854775807_int64_ssa(a int64) int64 {
return 9223372036854775807 - a
}
//go:noinline
func div_int64_Neg9223372036854775808_ssa(a int64) int64 {
return a / -9223372036854775808
}
//go:noinline
func div_Neg9223372036854775808_int64_ssa(a int64) int64 {
return -9223372036854775808 / a
}
//go:noinline
func div_int64_Neg9223372036854775807_ssa(a int64) int64 {
return a / -9223372036854775807
}
//go:noinline
func div_Neg9223372036854775807_int64_ssa(a int64) int64 {
return -9223372036854775807 / a
}
//go:noinline
func div_int64_Neg4294967296_ssa(a int64) int64 {
return a / -4294967296
}
//go:noinline
func div_Neg4294967296_int64_ssa(a int64) int64 {
return -4294967296 / a
}
//go:noinline
func div_int64_Neg1_ssa(a int64) int64 {
return a / -1
}
//go:noinline
func div_Neg1_int64_ssa(a int64) int64 {
return -1 / a
}
//go:noinline
func div_0_int64_ssa(a int64) int64 {
return 0 / a
}
//go:noinline
func div_int64_1_ssa(a int64) int64 {
return a / 1
}
//go:noinline
func div_1_int64_ssa(a int64) int64 {
return 1 / a
}
//go:noinline
func div_int64_4294967296_ssa(a int64) int64 {
return a / 4294967296
}
//go:noinline
func div_4294967296_int64_ssa(a int64) int64 {
return 4294967296 / a
}
//go:noinline
func div_int64_9223372036854775806_ssa(a int64) int64 {
return a / 9223372036854775806
}
//go:noinline
func div_9223372036854775806_int64_ssa(a int64) int64 {
return 9223372036854775806 / a
}
//go:noinline
func div_int64_9223372036854775807_ssa(a int64) int64 {
return a / 9223372036854775807
}
//go:noinline
func div_9223372036854775807_int64_ssa(a int64) int64 {
return 9223372036854775807 / a
}
//go:noinline
func mul_int64_Neg9223372036854775808_ssa(a int64) int64 {
return a * -9223372036854775808
}
//go:noinline
func mul_Neg9223372036854775808_int64_ssa(a int64) int64 {
return -9223372036854775808 * a
}
//go:noinline
func mul_int64_Neg9223372036854775807_ssa(a int64) int64 {
return a * -9223372036854775807
}
//go:noinline
func mul_Neg9223372036854775807_int64_ssa(a int64) int64 {
return -9223372036854775807 * a
}
//go:noinline
func mul_int64_Neg4294967296_ssa(a int64) int64 {
return a * -4294967296
}
//go:noinline
func mul_Neg4294967296_int64_ssa(a int64) int64 {
return -4294967296 * a
}
//go:noinline
func mul_int64_Neg1_ssa(a int64) int64 {
return a * -1
}
//go:noinline
func mul_Neg1_int64_ssa(a int64) int64 {
return -1 * a
}
//go:noinline
func mul_int64_0_ssa(a int64) int64 {
return a * 0
}
//go:noinline
func mul_0_int64_ssa(a int64) int64 {
return 0 * a
}
//go:noinline
func mul_int64_1_ssa(a int64) int64 {
return a * 1
}
//go:noinline
func mul_1_int64_ssa(a int64) int64 {
return 1 * a
}
//go:noinline
func mul_int64_4294967296_ssa(a int64) int64 {
return a * 4294967296
}
//go:noinline
func mul_4294967296_int64_ssa(a int64) int64 {
return 4294967296 * a
}
//go:noinline
func mul_int64_9223372036854775806_ssa(a int64) int64 {
return a * 9223372036854775806
}
//go:noinline
func mul_9223372036854775806_int64_ssa(a int64) int64 {
return 9223372036854775806 * a
}
//go:noinline
func mul_int64_9223372036854775807_ssa(a int64) int64 {
return a * 9223372036854775807
}
//go:noinline
func mul_9223372036854775807_int64_ssa(a int64) int64 {
return 9223372036854775807 * a
}
//go:noinline
func mod_int64_Neg9223372036854775808_ssa(a int64) int64 {
return a % -9223372036854775808
}
//go:noinline
func mod_Neg9223372036854775808_int64_ssa(a int64) int64 {
return -9223372036854775808 % a
}
//go:noinline
func mod_int64_Neg9223372036854775807_ssa(a int64) int64 {
return a % -9223372036854775807
}
//go:noinline
func mod_Neg9223372036854775807_int64_ssa(a int64) int64 {
return -9223372036854775807 % a
}
//go:noinline
func mod_int64_Neg4294967296_ssa(a int64) int64 {
return a % -4294967296
}
//go:noinline
func mod_Neg4294967296_int64_ssa(a int64) int64 {
return -4294967296 % a
}
//go:noinline
func mod_int64_Neg1_ssa(a int64) int64 {
return a % -1
}
//go:noinline
func mod_Neg1_int64_ssa(a int64) int64 {
return -1 % a
}
//go:noinline
func mod_0_int64_ssa(a int64) int64 {
return 0 % a
}
//go:noinline
func mod_int64_1_ssa(a int64) int64 {
return a % 1
}
//go:noinline
func mod_1_int64_ssa(a int64) int64 {
return 1 % a
}
//go:noinline
func mod_int64_4294967296_ssa(a int64) int64 {
return a % 4294967296
}
//go:noinline
func mod_4294967296_int64_ssa(a int64) int64 {
return 4294967296 % a
}
//go:noinline
func mod_int64_9223372036854775806_ssa(a int64) int64 {
return a % 9223372036854775806
}
//go:noinline
func mod_9223372036854775806_int64_ssa(a int64) int64 {
return 9223372036854775806 % a
}
//go:noinline
func mod_int64_9223372036854775807_ssa(a int64) int64 {
return a % 9223372036854775807
}
//go:noinline
func mod_9223372036854775807_int64_ssa(a int64) int64 {
return 9223372036854775807 % a
}
//go:noinline
func add_uint32_0_ssa(a uint32) uint32 {
return a + 0
}
//go:noinline
func add_0_uint32_ssa(a uint32) uint32 {
return 0 + a
}
//go:noinline
func add_uint32_1_ssa(a uint32) uint32 {
return a + 1
}
//go:noinline
func add_1_uint32_ssa(a uint32) uint32 {
return 1 + a
}
//go:noinline
func add_uint32_4294967295_ssa(a uint32) uint32 {
return a + 4294967295
}
//go:noinline
func add_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 + a
}
//go:noinline
func sub_uint32_0_ssa(a uint32) uint32 {
return a - 0
}
//go:noinline
func sub_0_uint32_ssa(a uint32) uint32 {
return 0 - a
}
//go:noinline
func sub_uint32_1_ssa(a uint32) uint32 {
return a - 1
}
//go:noinline
func sub_1_uint32_ssa(a uint32) uint32 {
return 1 - a
}
//go:noinline
func sub_uint32_4294967295_ssa(a uint32) uint32 {
return a - 4294967295
}
//go:noinline
func sub_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 - a
}
//go:noinline
func div_0_uint32_ssa(a uint32) uint32 {
return 0 / a
}
//go:noinline
func div_uint32_1_ssa(a uint32) uint32 {
return a / 1
}
//go:noinline
func div_1_uint32_ssa(a uint32) uint32 {
return 1 / a
}
//go:noinline
func div_uint32_4294967295_ssa(a uint32) uint32 {
return a / 4294967295
}
//go:noinline
func div_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 / a
}
//go:noinline
func mul_uint32_0_ssa(a uint32) uint32 {
return a * 0
}
//go:noinline
func mul_0_uint32_ssa(a uint32) uint32 {
return 0 * a
}
//go:noinline
func mul_uint32_1_ssa(a uint32) uint32 {
return a * 1
}
//go:noinline
func mul_1_uint32_ssa(a uint32) uint32 {
return 1 * a
}
//go:noinline
func mul_uint32_4294967295_ssa(a uint32) uint32 {
return a * 4294967295
}
//go:noinline
func mul_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 * a
}
//go:noinline
func lsh_uint32_0_ssa(a uint32) uint32 {
return a << 0
}
//go:noinline
func lsh_0_uint32_ssa(a uint32) uint32 {
return 0 << a
}
//go:noinline
func lsh_uint32_1_ssa(a uint32) uint32 {
return a << 1
}
//go:noinline
func lsh_1_uint32_ssa(a uint32) uint32 {
return 1 << a
}
//go:noinline
func lsh_uint32_4294967295_ssa(a uint32) uint32 {
return a << 4294967295
}
//go:noinline
func lsh_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 << a
}
//go:noinline
func rsh_uint32_0_ssa(a uint32) uint32 {
return a >> 0
}
//go:noinline
func rsh_0_uint32_ssa(a uint32) uint32 {
return 0 >> a
}
//go:noinline
func rsh_uint32_1_ssa(a uint32) uint32 {
return a >> 1
}
//go:noinline
func rsh_1_uint32_ssa(a uint32) uint32 {
return 1 >> a
}
//go:noinline
func rsh_uint32_4294967295_ssa(a uint32) uint32 {
return a >> 4294967295
}
//go:noinline
func rsh_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 >> a
}
//go:noinline
func mod_0_uint32_ssa(a uint32) uint32 {
return 0 % a
}
//go:noinline
func mod_uint32_1_ssa(a uint32) uint32 {
return a % 1
}
//go:noinline
func mod_1_uint32_ssa(a uint32) uint32 {
return 1 % a
}
//go:noinline
func mod_uint32_4294967295_ssa(a uint32) uint32 {
return a % 4294967295
}
//go:noinline
func mod_4294967295_uint32_ssa(a uint32) uint32 {
return 4294967295 % a
}
//go:noinline
func add_int32_Neg2147483648_ssa(a int32) int32 {
return a + -2147483648
}
//go:noinline
func add_Neg2147483648_int32_ssa(a int32) int32 {
return -2147483648 + a
}
//go:noinline
func add_int32_Neg2147483647_ssa(a int32) int32 {
return a + -2147483647
}
//go:noinline
func add_Neg2147483647_int32_ssa(a int32) int32 {
return -2147483647 + a
}
//go:noinline
func add_int32_Neg1_ssa(a int32) int32 {
return a + -1
}
//go:noinline
func add_Neg1_int32_ssa(a int32) int32 {
return -1 + a
}
//go:noinline
func add_int32_0_ssa(a int32) int32 {
return a + 0
}
//go:noinline
func add_0_int32_ssa(a int32) int32 {
return 0 + a
}
//go:noinline
func add_int32_1_ssa(a int32) int32 {
return a + 1
}
//go:noinline
func add_1_int32_ssa(a int32) int32 {
return 1 + a
}
//go:noinline
func add_int32_2147483647_ssa(a int32) int32 {
return a + 2147483647
}
//go:noinline
func add_2147483647_int32_ssa(a int32) int32 {
return 2147483647 + a
}
//go:noinline
func sub_int32_Neg2147483648_ssa(a int32) int32 {
return a - -2147483648
}
//go:noinline
func sub_Neg2147483648_int32_ssa(a int32) int32 {
return -2147483648 - a
}
//go:noinline
func sub_int32_Neg2147483647_ssa(a int32) int32 {
return a - -2147483647
}
//go:noinline
func sub_Neg2147483647_int32_ssa(a int32) int32 {
return -2147483647 - a
}
//go:noinline
func sub_int32_Neg1_ssa(a int32) int32 {
return a - -1
}
//go:noinline
func sub_Neg1_int32_ssa(a int32) int32 {
return -1 - a
}
//go:noinline
func sub_int32_0_ssa(a int32) int32 {
return a - 0
}
//go:noinline
func sub_0_int32_ssa(a int32) int32 {
return 0 - a
}
//go:noinline
func sub_int32_1_ssa(a int32) int32 {
return a - 1
}
//go:noinline
func sub_1_int32_ssa(a int32) int32 {
return 1 - a
}
//go:noinline
func sub_int32_2147483647_ssa(a int32) int32 {
return a - 2147483647
}
//go:noinline
func sub_2147483647_int32_ssa(a int32) int32 {
return 2147483647 - a
}
//go:noinline
func div_int32_Neg2147483648_ssa(a int32) int32 {
return a / -2147483648
}
//go:noinline
func div_Neg2147483648_int32_ssa(a int32) int32 {
return -2147483648 / a
}
//go:noinline
func div_int32_Neg2147483647_ssa(a int32) int32 {
return a / -2147483647
}
//go:noinline
func div_Neg2147483647_int32_ssa(a int32) int32 {
return -2147483647 / a
}
//go:noinline
func div_int32_Neg1_ssa(a int32) int32 {
return a / -1
}
//go:noinline
func div_Neg1_int32_ssa(a int32) int32 {
return -1 / a
}
//go:noinline
func div_0_int32_ssa(a int32) int32 {
return 0 / a
}
//go:noinline
func div_int32_1_ssa(a int32) int32 {
return a / 1
}
//go:noinline
func div_1_int32_ssa(a int32) int32 {
return 1 / a
}
//go:noinline
func div_int32_2147483647_ssa(a int32) int32 {
return a / 2147483647
}
//go:noinline
func div_2147483647_int32_ssa(a int32) int32 {
return 2147483647 / a
}
//go:noinline
func mul_int32_Neg2147483648_ssa(a int32) int32 {
return a * -2147483648
}
//go:noinline
func mul_Neg2147483648_int32_ssa(a int32) int32 {
return -2147483648 * a
}
//go:noinline
func mul_int32_Neg2147483647_ssa(a int32) int32 {
return a * -2147483647
}
//go:noinline
func mul_Neg2147483647_int32_ssa(a int32) int32 {
return -2147483647 * a
}
//go:noinline
func mul_int32_Neg1_ssa(a int32) int32 {
return a * -1
}
//go:noinline
func mul_Neg1_int32_ssa(a int32) int32 {
return -1 * a
}
//go:noinline
func mul_int32_0_ssa(a int32) int32 {
return a * 0
}
//go:noinline
func mul_0_int32_ssa(a int32) int32 {
return 0 * a
}
//go:noinline
func mul_int32_1_ssa(a int32) int32 {
return a * 1
}
//go:noinline
func mul_1_int32_ssa(a int32) int32 {
return 1 * a
}
//go:noinline
func mul_int32_2147483647_ssa(a int32) int32 {
return a * 2147483647
}
//go:noinline
func mul_2147483647_int32_ssa(a int32) int32 {
return 2147483647 * a
}
//go:noinline
func mod_int32_Neg2147483648_ssa(a int32) int32 {
return a % -2147483648
}
//go:noinline
func mod_Neg2147483648_int32_ssa(a int32) int32 {
return -2147483648 % a
}
//go:noinline
func mod_int32_Neg2147483647_ssa(a int32) int32 {
return a % -2147483647
}
//go:noinline
func mod_Neg2147483647_int32_ssa(a int32) int32 {
return -2147483647 % a
}
//go:noinline
func mod_int32_Neg1_ssa(a int32) int32 {
return a % -1
}
//go:noinline
func mod_Neg1_int32_ssa(a int32) int32 {
return -1 % a
}
//go:noinline
func mod_0_int32_ssa(a int32) int32 {
return 0 % a
}
//go:noinline
func mod_int32_1_ssa(a int32) int32 {
return a % 1
}
//go:noinline
func mod_1_int32_ssa(a int32) int32 {
return 1 % a
}
//go:noinline
func mod_int32_2147483647_ssa(a int32) int32 {
return a % 2147483647
}
//go:noinline
func mod_2147483647_int32_ssa(a int32) int32 {
return 2147483647 % a
}
//go:noinline
func add_uint16_0_ssa(a uint16) uint16 {
return a + 0
}
//go:noinline
func add_0_uint16_ssa(a uint16) uint16 {
return 0 + a
}
//go:noinline
func add_uint16_1_ssa(a uint16) uint16 {
return a + 1
}
//go:noinline
func add_1_uint16_ssa(a uint16) uint16 {
return 1 + a
}
//go:noinline
func add_uint16_65535_ssa(a uint16) uint16 {
return a + 65535
}
//go:noinline
func add_65535_uint16_ssa(a uint16) uint16 {
return 65535 + a
}
//go:noinline
func sub_uint16_0_ssa(a uint16) uint16 {
return a - 0
}
//go:noinline
func sub_0_uint16_ssa(a uint16) uint16 {
return 0 - a
}
//go:noinline
func sub_uint16_1_ssa(a uint16) uint16 {
return a - 1
}
//go:noinline
func sub_1_uint16_ssa(a uint16) uint16 {
return 1 - a
}
//go:noinline
func sub_uint16_65535_ssa(a uint16) uint16 {
return a - 65535
}
//go:noinline
func sub_65535_uint16_ssa(a uint16) uint16 {
return 65535 - a
}
//go:noinline
func div_0_uint16_ssa(a uint16) uint16 {
return 0 / a
}
//go:noinline
func div_uint16_1_ssa(a uint16) uint16 {
return a / 1
}
//go:noinline
func div_1_uint16_ssa(a uint16) uint16 {
return 1 / a
}
//go:noinline
func div_uint16_65535_ssa(a uint16) uint16 {
return a / 65535
}
//go:noinline
func div_65535_uint16_ssa(a uint16) uint16 {
return 65535 / a
}
//go:noinline
func mul_uint16_0_ssa(a uint16) uint16 {
return a * 0
}
//go:noinline
func mul_0_uint16_ssa(a uint16) uint16 {
return 0 * a
}
//go:noinline
func mul_uint16_1_ssa(a uint16) uint16 {
return a * 1
}
//go:noinline
func mul_1_uint16_ssa(a uint16) uint16 {
return 1 * a
}
//go:noinline
func mul_uint16_65535_ssa(a uint16) uint16 {
return a * 65535
}
//go:noinline
func mul_65535_uint16_ssa(a uint16) uint16 {
return 65535 * a
}
//go:noinline
func lsh_uint16_0_ssa(a uint16) uint16 {
return a << 0
}
//go:noinline
func lsh_0_uint16_ssa(a uint16) uint16 {
return 0 << a
}
//go:noinline
func lsh_uint16_1_ssa(a uint16) uint16 {
return a << 1
}
//go:noinline
func lsh_1_uint16_ssa(a uint16) uint16 {
return 1 << a
}
//go:noinline
func lsh_uint16_65535_ssa(a uint16) uint16 {
return a << 65535
}
//go:noinline
func lsh_65535_uint16_ssa(a uint16) uint16 {
return 65535 << a
}
//go:noinline
func rsh_uint16_0_ssa(a uint16) uint16 {
return a >> 0
}
//go:noinline
func rsh_0_uint16_ssa(a uint16) uint16 {
return 0 >> a
}
//go:noinline
func rsh_uint16_1_ssa(a uint16) uint16 {
return a >> 1
}
//go:noinline
func rsh_1_uint16_ssa(a uint16) uint16 {
return 1 >> a
}
//go:noinline
func rsh_uint16_65535_ssa(a uint16) uint16 {
return a >> 65535
}
//go:noinline
func rsh_65535_uint16_ssa(a uint16) uint16 {
return 65535 >> a
}
//go:noinline
func mod_0_uint16_ssa(a uint16) uint16 {
return 0 % a
}
//go:noinline
func mod_uint16_1_ssa(a uint16) uint16 {
return a % 1
}
//go:noinline
func mod_1_uint16_ssa(a uint16) uint16 {
return 1 % a
}
//go:noinline
func mod_uint16_65535_ssa(a uint16) uint16 {
return a % 65535
}
//go:noinline
func mod_65535_uint16_ssa(a uint16) uint16 {
return 65535 % a
}
//go:noinline
func add_int16_Neg32768_ssa(a int16) int16 {
return a + -32768
}
//go:noinline
func add_Neg32768_int16_ssa(a int16) int16 {
return -32768 + a
}
//go:noinline
func add_int16_Neg32767_ssa(a int16) int16 {
return a + -32767
}
//go:noinline
func add_Neg32767_int16_ssa(a int16) int16 {
return -32767 + a
}
//go:noinline
func add_int16_Neg1_ssa(a int16) int16 {
return a + -1
}
//go:noinline
func add_Neg1_int16_ssa(a int16) int16 {
return -1 + a
}
//go:noinline
func add_int16_0_ssa(a int16) int16 {
return a + 0
}
//go:noinline
func add_0_int16_ssa(a int16) int16 {
return 0 + a
}
//go:noinline
func add_int16_1_ssa(a int16) int16 {
return a + 1
}
//go:noinline
func add_1_int16_ssa(a int16) int16 {
return 1 + a
}
//go:noinline
func add_int16_32766_ssa(a int16) int16 {
return a + 32766
}
//go:noinline
func add_32766_int16_ssa(a int16) int16 {
return 32766 + a
}
//go:noinline
func add_int16_32767_ssa(a int16) int16 {
return a + 32767
}
//go:noinline
func add_32767_int16_ssa(a int16) int16 {
return 32767 + a
}
//go:noinline
func sub_int16_Neg32768_ssa(a int16) int16 {
return a - -32768
}
//go:noinline
func sub_Neg32768_int16_ssa(a int16) int16 {
return -32768 - a
}
//go:noinline
func sub_int16_Neg32767_ssa(a int16) int16 {
return a - -32767
}
//go:noinline
func sub_Neg32767_int16_ssa(a int16) int16 {
return -32767 - a
}
//go:noinline
func sub_int16_Neg1_ssa(a int16) int16 {
return a - -1
}
//go:noinline
func sub_Neg1_int16_ssa(a int16) int16 {
return -1 - a
}
//go:noinline
func sub_int16_0_ssa(a int16) int16 {
return a - 0
}
//go:noinline
func sub_0_int16_ssa(a int16) int16 {
return 0 - a
}
//go:noinline
func sub_int16_1_ssa(a int16) int16 {
return a - 1
}
//go:noinline
func sub_1_int16_ssa(a int16) int16 {
return 1 - a
}
//go:noinline
func sub_int16_32766_ssa(a int16) int16 {
return a - 32766
}
//go:noinline
func sub_32766_int16_ssa(a int16) int16 {
return 32766 - a
}
//go:noinline
func sub_int16_32767_ssa(a int16) int16 {
return a - 32767
}
//go:noinline
func sub_32767_int16_ssa(a int16) int16 {
return 32767 - a
}
//go:noinline
func div_int16_Neg32768_ssa(a int16) int16 {
return a / -32768
}
//go:noinline
func div_Neg32768_int16_ssa(a int16) int16 {
return -32768 / a
}
//go:noinline
func div_int16_Neg32767_ssa(a int16) int16 {
return a / -32767
}
//go:noinline
func div_Neg32767_int16_ssa(a int16) int16 {
return -32767 / a
}
//go:noinline
func div_int16_Neg1_ssa(a int16) int16 {
return a / -1
}
//go:noinline
func div_Neg1_int16_ssa(a int16) int16 {
return -1 / a
}
//go:noinline
func div_0_int16_ssa(a int16) int16 {
return 0 / a
}
//go:noinline
func div_int16_1_ssa(a int16) int16 {
return a / 1
}
//go:noinline
func div_1_int16_ssa(a int16) int16 {
return 1 / a
}
//go:noinline
func div_int16_32766_ssa(a int16) int16 {
return a / 32766
}
//go:noinline
func div_32766_int16_ssa(a int16) int16 {
return 32766 / a
}
//go:noinline
func div_int16_32767_ssa(a int16) int16 {
return a / 32767
}
//go:noinline
func div_32767_int16_ssa(a int16) int16 {
return 32767 / a
}
//go:noinline
func mul_int16_Neg32768_ssa(a int16) int16 {
return a * -32768
}
//go:noinline
func mul_Neg32768_int16_ssa(a int16) int16 {
return -32768 * a
}
//go:noinline
func mul_int16_Neg32767_ssa(a int16) int16 {
return a * -32767
}
//go:noinline
func mul_Neg32767_int16_ssa(a int16) int16 {
return -32767 * a
}
//go:noinline
func mul_int16_Neg1_ssa(a int16) int16 {
return a * -1
}
//go:noinline
func mul_Neg1_int16_ssa(a int16) int16 {
return -1 * a
}
//go:noinline
func mul_int16_0_ssa(a int16) int16 {
return a * 0
}
//go:noinline
func mul_0_int16_ssa(a int16) int16 {
return 0 * a
}
//go:noinline
func mul_int16_1_ssa(a int16) int16 {
return a * 1
}
//go:noinline
func mul_1_int16_ssa(a int16) int16 {
return 1 * a
}
//go:noinline
func mul_int16_32766_ssa(a int16) int16 {
return a * 32766
}
//go:noinline
func mul_32766_int16_ssa(a int16) int16 {
return 32766 * a
}
//go:noinline
func mul_int16_32767_ssa(a int16) int16 {
return a * 32767
}
//go:noinline
func mul_32767_int16_ssa(a int16) int16 {
return 32767 * a
}
//go:noinline
func mod_int16_Neg32768_ssa(a int16) int16 {
return a % -32768
}
//go:noinline
func mod_Neg32768_int16_ssa(a int16) int16 {
return -32768 % a
}
//go:noinline
func mod_int16_Neg32767_ssa(a int16) int16 {
return a % -32767
}
//go:noinline
func mod_Neg32767_int16_ssa(a int16) int16 {
return -32767 % a
}
//go:noinline
func mod_int16_Neg1_ssa(a int16) int16 {
return a % -1
}
//go:noinline
func mod_Neg1_int16_ssa(a int16) int16 {
return -1 % a
}
//go:noinline
func mod_0_int16_ssa(a int16) int16 {
return 0 % a
}
//go:noinline
func mod_int16_1_ssa(a int16) int16 {
return a % 1
}
//go:noinline
func mod_1_int16_ssa(a int16) int16 {
return 1 % a
}
//go:noinline
func mod_int16_32766_ssa(a int16) int16 {
return a % 32766
}
//go:noinline
func mod_32766_int16_ssa(a int16) int16 {
return 32766 % a
}
//go:noinline
func mod_int16_32767_ssa(a int16) int16 {
return a % 32767
}
//go:noinline
func mod_32767_int16_ssa(a int16) int16 {
return 32767 % a
}
//go:noinline
func add_uint8_0_ssa(a uint8) uint8 {
return a + 0
}
//go:noinline
func add_0_uint8_ssa(a uint8) uint8 {
return 0 + a
}
//go:noinline
func add_uint8_1_ssa(a uint8) uint8 {
return a + 1
}
//go:noinline
func add_1_uint8_ssa(a uint8) uint8 {
return 1 + a
}
//go:noinline
func add_uint8_255_ssa(a uint8) uint8 {
return a + 255
}
//go:noinline
func add_255_uint8_ssa(a uint8) uint8 {
return 255 + a
}
//go:noinline
func sub_uint8_0_ssa(a uint8) uint8 {
return a - 0
}
//go:noinline
func sub_0_uint8_ssa(a uint8) uint8 {
return 0 - a
}
//go:noinline
func sub_uint8_1_ssa(a uint8) uint8 {
return a - 1
}
//go:noinline
func sub_1_uint8_ssa(a uint8) uint8 {
return 1 - a
}
//go:noinline
func sub_uint8_255_ssa(a uint8) uint8 {
return a - 255
}
//go:noinline
func sub_255_uint8_ssa(a uint8) uint8 {
return 255 - a
}
//go:noinline
func div_0_uint8_ssa(a uint8) uint8 {
return 0 / a
}
//go:noinline
func div_uint8_1_ssa(a uint8) uint8 {
return a / 1
}
//go:noinline
func div_1_uint8_ssa(a uint8) uint8 {
return 1 / a
}
//go:noinline
func div_uint8_255_ssa(a uint8) uint8 {
return a / 255
}
//go:noinline
func div_255_uint8_ssa(a uint8) uint8 {
return 255 / a
}
//go:noinline
func mul_uint8_0_ssa(a uint8) uint8 {
return a * 0
}
//go:noinline
func mul_0_uint8_ssa(a uint8) uint8 {
return 0 * a
}
//go:noinline
func mul_uint8_1_ssa(a uint8) uint8 {
return a * 1
}
//go:noinline
func mul_1_uint8_ssa(a uint8) uint8 {
return 1 * a
}
//go:noinline
func mul_uint8_255_ssa(a uint8) uint8 {
return a * 255
}
//go:noinline
func mul_255_uint8_ssa(a uint8) uint8 {
return 255 * a
}
//go:noinline
func lsh_uint8_0_ssa(a uint8) uint8 {
return a << 0
}
//go:noinline
func lsh_0_uint8_ssa(a uint8) uint8 {
return 0 << a
}
//go:noinline
func lsh_uint8_1_ssa(a uint8) uint8 {
return a << 1
}
//go:noinline
func lsh_1_uint8_ssa(a uint8) uint8 {
return 1 << a
}
//go:noinline
func lsh_uint8_255_ssa(a uint8) uint8 {
return a << 255
}
//go:noinline
func lsh_255_uint8_ssa(a uint8) uint8 {
return 255 << a
}
//go:noinline
func rsh_uint8_0_ssa(a uint8) uint8 {
return a >> 0
}
//go:noinline
func rsh_0_uint8_ssa(a uint8) uint8 {
return 0 >> a
}
//go:noinline
func rsh_uint8_1_ssa(a uint8) uint8 {
return a >> 1
}
//go:noinline
func rsh_1_uint8_ssa(a uint8) uint8 {
return 1 >> a
}
//go:noinline
func rsh_uint8_255_ssa(a uint8) uint8 {
return a >> 255
}
//go:noinline
func rsh_255_uint8_ssa(a uint8) uint8 {
return 255 >> a
}
//go:noinline
func mod_0_uint8_ssa(a uint8) uint8 {
return 0 % a
}
//go:noinline
func mod_uint8_1_ssa(a uint8) uint8 {
return a % 1
}
//go:noinline
func mod_1_uint8_ssa(a uint8) uint8 {
return 1 % a
}
//go:noinline
func mod_uint8_255_ssa(a uint8) uint8 {
return a % 255
}
//go:noinline
func mod_255_uint8_ssa(a uint8) uint8 {
return 255 % a
}
//go:noinline
func add_int8_Neg128_ssa(a int8) int8 {
return a + -128
}
//go:noinline
func add_Neg128_int8_ssa(a int8) int8 {
return -128 + a
}
//go:noinline
func add_int8_Neg127_ssa(a int8) int8 {
return a + -127
}
//go:noinline
func add_Neg127_int8_ssa(a int8) int8 {
return -127 + a
}
//go:noinline
func add_int8_Neg1_ssa(a int8) int8 {
return a + -1
}
//go:noinline
func add_Neg1_int8_ssa(a int8) int8 {
return -1 + a
}
//go:noinline
func add_int8_0_ssa(a int8) int8 {
return a + 0
}
//go:noinline
func add_0_int8_ssa(a int8) int8 {
return 0 + a
}
//go:noinline
func add_int8_1_ssa(a int8) int8 {
return a + 1
}
//go:noinline
func add_1_int8_ssa(a int8) int8 {
return 1 + a
}
//go:noinline
func add_int8_126_ssa(a int8) int8 {
return a + 126
}
//go:noinline
func add_126_int8_ssa(a int8) int8 {
return 126 + a
}
//go:noinline
func add_int8_127_ssa(a int8) int8 {
return a + 127
}
//go:noinline
func add_127_int8_ssa(a int8) int8 {
return 127 + a
}
//go:noinline
func sub_int8_Neg128_ssa(a int8) int8 {
return a - -128
}
//go:noinline
func sub_Neg128_int8_ssa(a int8) int8 {
return -128 - a
}
//go:noinline
func sub_int8_Neg127_ssa(a int8) int8 {
return a - -127
}
//go:noinline
func sub_Neg127_int8_ssa(a int8) int8 {
return -127 - a
}
//go:noinline
func sub_int8_Neg1_ssa(a int8) int8 {
return a - -1
}
//go:noinline
func sub_Neg1_int8_ssa(a int8) int8 {
return -1 - a
}
//go:noinline
func sub_int8_0_ssa(a int8) int8 {
return a - 0
}
//go:noinline
func sub_0_int8_ssa(a int8) int8 {
return 0 - a
}
//go:noinline
func sub_int8_1_ssa(a int8) int8 {
return a - 1
}
//go:noinline
func sub_1_int8_ssa(a int8) int8 {
return 1 - a
}
//go:noinline
func sub_int8_126_ssa(a int8) int8 {
return a - 126
}
//go:noinline
func sub_126_int8_ssa(a int8) int8 {
return 126 - a
}
//go:noinline
func sub_int8_127_ssa(a int8) int8 {
return a - 127
}
//go:noinline
func sub_127_int8_ssa(a int8) int8 {
return 127 - a
}
//go:noinline
func div_int8_Neg128_ssa(a int8) int8 {
return a / -128
}
//go:noinline
func div_Neg128_int8_ssa(a int8) int8 {
return -128 / a
}
//go:noinline
func div_int8_Neg127_ssa(a int8) int8 {
return a / -127
}
//go:noinline
func div_Neg127_int8_ssa(a int8) int8 {
return -127 / a
}
//go:noinline
func div_int8_Neg1_ssa(a int8) int8 {
return a / -1
}
//go:noinline
func div_Neg1_int8_ssa(a int8) int8 {
return -1 / a
}
//go:noinline
func div_0_int8_ssa(a int8) int8 {
return 0 / a
}
//go:noinline
func div_int8_1_ssa(a int8) int8 {
return a / 1
}
//go:noinline
func div_1_int8_ssa(a int8) int8 {
return 1 / a
}
//go:noinline
func div_int8_126_ssa(a int8) int8 {
return a / 126
}
//go:noinline
func div_126_int8_ssa(a int8) int8 {
return 126 / a
}
//go:noinline
func div_int8_127_ssa(a int8) int8 {
return a / 127
}
//go:noinline
func div_127_int8_ssa(a int8) int8 {
return 127 / a
}
//go:noinline
func mul_int8_Neg128_ssa(a int8) int8 {
return a * -128
}
//go:noinline
func mul_Neg128_int8_ssa(a int8) int8 {
return -128 * a
}
//go:noinline
func mul_int8_Neg127_ssa(a int8) int8 {
return a * -127
}
//go:noinline
func mul_Neg127_int8_ssa(a int8) int8 {
return -127 * a
}
//go:noinline
func mul_int8_Neg1_ssa(a int8) int8 {
return a * -1
}
//go:noinline
func mul_Neg1_int8_ssa(a int8) int8 {
return -1 * a
}
//go:noinline
func mul_int8_0_ssa(a int8) int8 {
return a * 0
}
//go:noinline
func mul_0_int8_ssa(a int8) int8 {
return 0 * a
}
//go:noinline
func mul_int8_1_ssa(a int8) int8 {
return a * 1
}
//go:noinline
func mul_1_int8_ssa(a int8) int8 {
return 1 * a
}
//go:noinline
func mul_int8_126_ssa(a int8) int8 {
return a * 126
}
//go:noinline
func mul_126_int8_ssa(a int8) int8 {
return 126 * a
}
//go:noinline
func mul_int8_127_ssa(a int8) int8 {
return a * 127
}
//go:noinline
func mul_127_int8_ssa(a int8) int8 {
return 127 * a
}
//go:noinline
func mod_int8_Neg128_ssa(a int8) int8 {
return a % -128
}
//go:noinline
func mod_Neg128_int8_ssa(a int8) int8 {
return -128 % a
}
//go:noinline
func mod_int8_Neg127_ssa(a int8) int8 {
return a % -127
}
//go:noinline
func mod_Neg127_int8_ssa(a int8) int8 {
return -127 % a
}
//go:noinline
func mod_int8_Neg1_ssa(a int8) int8 {
return a % -1
}
//go:noinline
func mod_Neg1_int8_ssa(a int8) int8 {
return -1 % a
}
//go:noinline
func mod_0_int8_ssa(a int8) int8 {
return 0 % a
}
//go:noinline
func mod_int8_1_ssa(a int8) int8 {
return a % 1
}
//go:noinline
func mod_1_int8_ssa(a int8) int8 {
return 1 % a
}
//go:noinline
func mod_int8_126_ssa(a int8) int8 {
return a % 126
}
//go:noinline
func mod_126_int8_ssa(a int8) int8 {
return 126 % a
}
//go:noinline
func mod_int8_127_ssa(a int8) int8 {
return a % 127
}
//go:noinline
func mod_127_int8_ssa(a int8) int8 {
return 127 % a
}
var failed bool
func main() {
if got := add_0_uint64_ssa(0); got != 0 {
fmt.Printf("add_uint64 0%s0 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_uint64_0_ssa(0); got != 0 {
fmt.Printf("add_uint64 0%s0 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_0_uint64_ssa(1); got != 1 {
fmt.Printf("add_uint64 0%s1 = %d, wanted 1\n", `+`, got)
failed = true
}
if got := add_uint64_0_ssa(1); got != 1 {
fmt.Printf("add_uint64 1%s0 = %d, wanted 1\n", `+`, got)
failed = true
}
if got := add_0_uint64_ssa(4294967296); got != 4294967296 {
fmt.Printf("add_uint64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got)
failed = true
}
if got := add_uint64_0_ssa(4294967296); got != 4294967296 {
fmt.Printf("add_uint64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got)
failed = true
}
if got := add_0_uint64_ssa(18446744073709551615); got != 18446744073709551615 {
fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true
}
if got := add_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 {
fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true
}
if got := add_1_uint64_ssa(0); got != 1 {
fmt.Printf("add_uint64 1%s0 = %d, wanted 1\n", `+`, got)
failed = true
}
if got := add_uint64_1_ssa(0); got != 1 {
fmt.Printf("add_uint64 0%s1 = %d, wanted 1\n", `+`, got)
failed = true
}
if got := add_1_uint64_ssa(1); got != 2 {
fmt.Printf("add_uint64 1%s1 = %d, wanted 2\n", `+`, got)
failed = true
}
if got := add_uint64_1_ssa(1); got != 2 {
fmt.Printf("add_uint64 1%s1 = %d, wanted 2\n", `+`, got)
failed = true
}
if got := add_1_uint64_ssa(4294967296); got != 4294967297 {
fmt.Printf("add_uint64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got)
failed = true
}
if got := add_uint64_1_ssa(4294967296); got != 4294967297 {
fmt.Printf("add_uint64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got)
failed = true
}
if got := add_1_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_uint64_1_ssa(18446744073709551615); got != 0 {
fmt.Printf("add_uint64 18446744073709551615%s1 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_4294967296_uint64_ssa(0); got != 4294967296 {
fmt.Printf("add_uint64 4294967296%s0 = %d, wanted 4294967296\n", `+`, got)
failed = true
}
if got := add_uint64_4294967296_ssa(0); got != 4294967296 {
fmt.Printf("add_uint64 0%s4294967296 = %d, wanted 4294967296\n", `+`, got)
failed = true
}
if got := add_4294967296_uint64_ssa(1); got != 4294967297 {
fmt.Printf("add_uint64 4294967296%s1 = %d, wanted 4294967297\n", `+`, got)
failed = true
}
if got := add_uint64_4294967296_ssa(1); got != 4294967297 {
fmt.Printf("add_uint64 1%s4294967296 = %d, wanted 4294967297\n", `+`, got)
failed = true
}
if got := add_4294967296_uint64_ssa(4294967296); got != 8589934592 {
fmt.Printf("add_uint64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got)
failed = true
}
if got := add_uint64_4294967296_ssa(4294967296); got != 8589934592 {
fmt.Printf("add_uint64 4294967296%s4294967296 = %d, wanted 8589934592\n", `+`, got)
failed = true
}
if got := add_4294967296_uint64_ssa(18446744073709551615); got != 4294967295 {
fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got)
failed = true
}
if got := add_uint64_4294967296_ssa(18446744073709551615); got != 4294967295 {
fmt.Printf("add_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("add_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true
}
if got := add_uint64_18446744073709551615_ssa(0); got != 18446744073709551615 {
fmt.Printf("add_uint64 0%s18446744073709551615 = %d, wanted 18446744073709551615\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(1); got != 0 {
fmt.Printf("add_uint64 18446744073709551615%s1 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_uint64_18446744073709551615_ssa(1); got != 0 {
fmt.Printf("add_uint64 1%s18446744073709551615 = %d, wanted 0\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(4294967296); got != 4294967295 {
fmt.Printf("add_uint64 18446744073709551615%s4294967296 = %d, wanted 4294967295\n", `+`, got)
failed = true
}
if got := add_uint64_18446744073709551615_ssa(4294967296); got != 4294967295 {
fmt.Printf("add_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967295\n", `+`, got)
failed = true
}
if got := add_18446744073709551615_uint64_ssa(18446744073709551615); got != 18446744073709551614 {
fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got)
failed = true
}
if got := add_uint64_18446744073709551615_ssa(18446744073709551615); got != 18446744073709551614 {
fmt.Printf("add_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 18446744073709551614\n", `+`, got)
failed = true
}
if got := sub_0_uint64_ssa(0); got != 0 {
fmt.Printf("sub_uint64 0%s0 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_uint64_0_ssa(0); got != 0 {
fmt.Printf("sub_uint64 0%s0 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_0_uint64_ssa(1); got != 18446744073709551615 {
fmt.Printf("sub_uint64 0%s1 = %d, wanted 18446744073709551615\n", `-`, got)
failed = true
}
if got := sub_uint64_0_ssa(1); got != 1 {
fmt.Printf("sub_uint64 1%s0 = %d, wanted 1\n", `-`, got)
failed = true
}
if got := sub_0_uint64_ssa(4294967296); got != 18446744069414584320 {
fmt.Printf("sub_uint64 0%s4294967296 = %d, wanted 18446744069414584320\n", `-`, got)
failed = true
}
if got := sub_uint64_0_ssa(4294967296); got != 4294967296 {
fmt.Printf("sub_uint64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got)
failed = true
}
if got := sub_0_uint64_ssa(18446744073709551615); got != 1 {
fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got)
failed = true
}
if got := sub_uint64_0_ssa(18446744073709551615); got != 18446744073709551615 {
fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got)
failed = true
}
if got := sub_1_uint64_ssa(0); got != 1 {
fmt.Printf("sub_uint64 1%s0 = %d, wanted 1\n", `-`, got)
failed = true
}
if got := sub_uint64_1_ssa(0); got != 18446744073709551615 {
fmt.Printf("sub_uint64 0%s1 = %d, wanted 18446744073709551615\n", `-`, got)
failed = true
}
if got := sub_1_uint64_ssa(1); got != 0 {
fmt.Printf("sub_uint64 1%s1 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_uint64_1_ssa(1); got != 0 {
fmt.Printf("sub_uint64 1%s1 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_1_uint64_ssa(4294967296); got != 18446744069414584321 {
fmt.Printf("sub_uint64 1%s4294967296 = %d, wanted 18446744069414584321\n", `-`, got)
failed = true
}
if got := sub_uint64_1_ssa(4294967296); got != 4294967295 {
fmt.Printf("sub_uint64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got)
failed = true
}
if got := sub_1_uint64_ssa(18446744073709551615); got != 2 {
fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got)
failed = true
}
if got := sub_uint64_1_ssa(18446744073709551615); got != 18446744073709551614 {
fmt.Printf("sub_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `-`, got)
failed = true
}
if got := sub_4294967296_uint64_ssa(0); got != 4294967296 {
fmt.Printf("sub_uint64 4294967296%s0 = %d, wanted 4294967296\n", `-`, got)
failed = true
}
if got := sub_uint64_4294967296_ssa(0); got != 18446744069414584320 {
fmt.Printf("sub_uint64 0%s4294967296 = %d, wanted 18446744069414584320\n", `-`, got)
failed = true
}
if got := sub_4294967296_uint64_ssa(1); got != 4294967295 {
fmt.Printf("sub_uint64 4294967296%s1 = %d, wanted 4294967295\n", `-`, got)
failed = true
}
if got := sub_uint64_4294967296_ssa(1); got != 18446744069414584321 {
fmt.Printf("sub_uint64 1%s4294967296 = %d, wanted 18446744069414584321\n", `-`, got)
failed = true
}
if got := sub_4294967296_uint64_ssa(4294967296); got != 0 {
fmt.Printf("sub_uint64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_uint64_4294967296_ssa(4294967296); got != 0 {
fmt.Printf("sub_uint64 4294967296%s4294967296 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_4294967296_uint64_ssa(18446744073709551615); got != 4294967297 {
fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got)
failed = true
}
if got := sub_uint64_4294967296_ssa(18446744073709551615); got != 18446744069414584319 {
fmt.Printf("sub_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584319\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(0); got != 18446744073709551615 {
fmt.Printf("sub_uint64 18446744073709551615%s0 = %d, wanted 18446744073709551615\n", `-`, got)
failed = true
}
if got := sub_uint64_18446744073709551615_ssa(0); got != 1 {
fmt.Printf("sub_uint64 0%s18446744073709551615 = %d, wanted 1\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(1); got != 18446744073709551614 {
fmt.Printf("sub_uint64 18446744073709551615%s1 = %d, wanted 18446744073709551614\n", `-`, got)
failed = true
}
if got := sub_uint64_18446744073709551615_ssa(1); got != 2 {
fmt.Printf("sub_uint64 1%s18446744073709551615 = %d, wanted 2\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(4294967296); got != 18446744069414584319 {
fmt.Printf("sub_uint64 18446744073709551615%s4294967296 = %d, wanted 18446744069414584319\n", `-`, got)
failed = true
}
if got := sub_uint64_18446744073709551615_ssa(4294967296); got != 4294967297 {
fmt.Printf("sub_uint64 4294967296%s18446744073709551615 = %d, wanted 4294967297\n", `-`, got)
failed = true
}
if got := sub_18446744073709551615_uint64_ssa(18446744073709551615); got != 0 {
fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got)
failed = true
}
if got := sub_uint64_18446744073709551615_ssa(18446744073709551615); got != 0 {
fmt.Printf("sub_uint64 18446744073709551615%s18446744073709551615 = %d, wanted 0\n", `-`, got)
fail
gitextract_6x5ebcjo/
├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── Cargo.toml
├── README.md
├── benches/
│ └── parse.rs
├── misc/
│ ├── log.md
│ └── selector-inconsistency.md
├── src/
│ ├── ast/
│ │ ├── expressions.rs
│ │ ├── mod.rs
│ │ ├── statements.rs
│ │ └── types.rs
│ ├── lexer/
│ │ ├── mod.rs
│ │ └── test.rs
│ ├── lib.rs
│ ├── main.rs
│ ├── parser/
│ │ ├── error.rs
│ │ ├── mod.rs
│ │ └── test.rs
│ ├── pos.rs
│ └── token.rs
└── tests/
├── data/
│ └── pass/
│ ├── arithConst_ssa.go
│ ├── hello.go
│ ├── precedence.go
│ ├── rewriteAMD64.go
│ ├── simplest.go
│ └── viper.go
└── runner.rs
SYMBOL INDEX (1267 symbols across 20 files)
FILE: src/ast/expressions.rs
type Expr (line 24) | pub enum Expr {
type BinaryOperator (line 30) | pub enum BinaryOperator {
method from_token_kind (line 56) | pub fn from_token_kind(tok: TokenKind) -> Option<BinaryOperator> {
method from_token_kind_assign_op (line 86) | pub fn from_token_kind_assign_op(tok: TokenKind) -> Option<BinaryOpera...
method precedence (line 107) | pub fn precedence(self) -> i32 {
type BinaryExpr (line 121) | pub struct BinaryExpr {
type UnaryExpr (line 128) | pub enum UnaryExpr {
type UnaryOperation (line 134) | pub struct UnaryOperation {
type UnaryOperator (line 148) | pub enum UnaryOperator {
method from_token_kind (line 159) | pub fn from_token_kind(k: TokenKind) -> Option<UnaryOperator> {
type PrimaryExpr (line 200) | pub enum PrimaryExpr {
type Operand (line 215) | pub enum Operand {
type SelectorExpr (line 235) | pub struct SelectorExpr {
type IndexExpr (line 248) | pub struct IndexExpr {
type SliceExpr (line 264) | pub struct SliceExpr {
type Slicing (line 280) | pub struct Slicing {
type TypeAssertion (line 290) | pub struct TypeAssertion {
type FuncCall (line 299) | pub struct FuncCall {
type MethodExpr (line 319) | pub struct MethodExpr {
FILE: src/ast/mod.rs
type Ident (line 23) | pub type Ident = String;
type TypeName (line 24) | pub type TypeName = MaybeQualifiedIdent;
type MethodName (line 25) | pub type MethodName = Ident;
type SourceFile (line 35) | pub struct SourceFile {
type ImportDecl (line 62) | pub struct ImportDecl {
type ImportSpec (line 85) | pub struct ImportSpec {
type ImportKind (line 91) | pub enum ImportKind {
type TopLevelDecl (line 104) | pub enum TopLevelDecl {
type FuncDecl (line 117) | pub struct FuncDecl {
type FuncSignature (line 127) | pub struct FuncSignature {
type Parameters (line 135) | pub struct Parameters {
method empty (line 141) | pub fn empty() -> Parameters {
method from_single_type (line 146) | pub fn from_single_type(t: Type) -> Parameters {
type ParameterDecl (line 160) | pub struct ParameterDecl {
type Type (line 173) | pub enum Type {
type TypeLiteral (line 179) | pub enum TypeLiteral {
type Literal (line 191) | pub enum Literal {
type MaybeQualifiedIdent (line 201) | pub struct MaybeQualifiedIdent {
type ConstDecl (line 217) | pub struct ConstDecl {
type ConstSpec (line 229) | pub struct ConstSpec {
type ConstSpecInner (line 236) | pub struct ConstSpecInner {
type MethodDecl (line 252) | pub struct MethodDecl {
type TypeDecl (line 270) | pub struct TypeDecl {
type TypeSpec (line 276) | pub struct TypeSpec {
type VarDecl (line 290) | pub struct VarDecl {
type VarSpec (line 300) | pub struct VarSpec {
type Conversion (line 315) | pub struct Conversion {
type ShortVarDecl (line 325) | pub struct ShortVarDecl {
type Block (line 331) | pub struct Block(pub Vec<Statement>);
type BasicLit (line 336) | pub enum BasicLit {
type CompositeLit (line 363) | pub struct CompositeLit {
type LiteralType (line 369) | pub enum LiteralType {
type LiteralValue (line 380) | pub struct LiteralValue {
type KeyedElem (line 385) | pub struct KeyedElem {
type Key (line 391) | pub enum Key {
type Elem (line 398) | pub enum Elem {
type FuncLit (line 414) | pub struct FuncLit {
type Arguments (line 425) | pub struct Arguments {
FILE: src/ast/statements.rs
type Statement (line 14) | pub enum Statement {
type SimpleStmt (line 66) | pub enum SimpleStmt {
type LabeledStmt (line 76) | pub struct LabeledStmt;
type GoStmt (line 81) | pub struct GoStmt {
type DeferStmt (line 91) | pub struct DeferStmt {
type ReturnStmt (line 97) | pub struct ReturnStmt {
type BreakStmt (line 103) | pub struct BreakStmt {
type ContinueStmt (line 109) | pub struct ContinueStmt {
type GotoStmt (line 115) | pub struct GotoStmt {
type FallthroughStmt (line 121) | pub struct FallthroughStmt;
type IfStmt (line 131) | pub struct IfStmt {
type Else (line 140) | pub enum Else {
type SwitchStmt (line 149) | pub struct SwitchStmt;
type SelectStmt (line 151) | pub struct SelectStmt;
type ForStmt (line 155) | pub struct ForStmt {
type ForHeader (line 163) | pub enum ForHeader {
type ForClause (line 176) | pub struct ForClause {
type RangeClause (line 185) | pub struct RangeClause {
type IterVars (line 194) | pub enum IterVars {
type SendStmt (line 202) | pub struct SendStmt {
type IncDecStmt (line 208) | pub struct IncDecStmt {
type Assignment (line 216) | pub struct Assignment {
type EmptyStmt (line 225) | pub struct EmptyStmt;
type DeclStmt (line 230) | pub enum DeclStmt {
FILE: src/ast/types.rs
type ArrayType (line 13) | pub struct ArrayType {
type StructType (line 26) | pub struct StructType {
type FieldDecl (line 39) | pub struct FieldDecl {
type InnerFieldDecl (line 54) | pub enum InnerFieldDecl {
type PointerType (line 68) | pub struct PointerType(pub Type);
type FuncType (line 81) | pub struct FuncType {
type InterfaceType (line 94) | pub struct InterfaceType {
type MethodSpec (line 108) | pub struct MethodSpec {
type InnerMethodSpec (line 115) | pub enum InnerMethodSpec {
type SliceType (line 129) | pub struct SliceType {
type MapType (line 143) | pub struct MapType {
type ChanType (line 158) | pub struct ChanType {
type ChanDirection (line 167) | pub enum ChanDirection {
FILE: src/lexer/mod.rs
type Lexer (line 26) | pub struct Lexer<'src> {
function new (line 39) | pub fn new(s: &str) -> Lexer {
function bump (line 53) | fn bump(&mut self) {
function next_char (line 66) | fn next_char(&self) -> Option<char> {
function scan_number (line 80) | fn scan_number(&mut self) -> Token {
function skip_whitespace_and_comments (line 156) | fn skip_whitespace_and_comments(&mut self) -> bool {
function scan_ident (line 212) | fn scan_ident(&mut self) -> &str {
function scan_ident_or_keyword (line 226) | fn scan_ident_or_keyword(&mut self) -> Token {
function next_token_inner (line 272) | fn next_token_inner(&mut self) -> Option<Token> {
function scan_rune_lit (line 553) | fn scan_rune_lit(&mut self) -> Token {
function scan_interpreted_str_lit (line 583) | fn scan_interpreted_str_lit(&mut self) -> Token {
function scan_raw_str_lit (line 613) | fn scan_raw_str_lit(&mut self) -> Token {
type Item (line 642) | type Item = TokenAndSpan;
method next (line 644) | fn next(&mut self) -> Option<TokenAndSpan> {
function tokenize (line 662) | pub fn tokenize(s: &str) -> Vec<TokenAndSpan> {
function can_start_identifier (line 674) | fn can_start_identifier(c: char) -> bool {
function can_continue_identifier (line 678) | fn can_continue_identifier(c: char) -> bool {
function char_at (line 682) | fn char_at(s: &str, byte: usize) -> char {
function may_terminate_statement (line 687) | fn may_terminate_statement(t: Option<TokenKind>) -> bool {
FILE: src/lexer/test.rs
function assert_tokens (line 6) | fn assert_tokens(code: &str, expect: &[(TokenKind, Option<&str>)]) {
function assert_token (line 23) | fn assert_token(code: &str, expect_kind: TokenKind, expect_value: Option...
function test_numerical_tokens (line 28) | fn test_numerical_tokens() {
function test_text_literals (line 53) | fn test_text_literals() {
function tokenize_simple (line 68) | fn tokenize_simple() {
function tokenize_comments (line 129) | fn tokenize_comments() {
function tokenize_ident (line 137) | fn tokenize_ident() {
function tokenize_keywords (line 147) | fn tokenize_keywords() {
function tokenize_mixed_whitespace (line 180) | fn tokenize_mixed_whitespace() {
function tokenize_package_declaration (line 188) | fn tokenize_package_declaration() {
function tokenize_plain_interpreted_str (line 194) | fn tokenize_plain_interpreted_str() {
function tokenize_simple_import (line 199) | fn tokenize_simple_import() {
function tokenize_simple_assignment (line 205) | fn tokenize_simple_assignment() {
function tokenize_hello (line 215) | fn tokenize_hello() {
function tokenize_simple_assignment_with_inline_comment (line 254) | fn tokenize_simple_assignment_with_inline_comment() {
function tokenize_hello_with_comments (line 264) | fn tokenize_hello_with_comments() {
FILE: src/lib.rs
function parse (line 24) | pub fn parse(src: &str) -> ast::SourceFile {
FILE: src/main.rs
function main (line 11) | fn main() {
FILE: src/parser/error.rs
type PResult (line 4) | pub type PResult<T> = ::std::result::Result<T, Error>;
type Error (line 7) | pub struct Error {
type ErrorKind (line 13) | pub enum ErrorKind {
method unexpected_token (line 24) | pub fn unexpected_token(expected: Vec<TokenKind>, found: Token) -> Err...
method other (line 34) | pub fn other<T: Into<String>>(msg: T) -> ErrorKind {
method fmt (line 40) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
FILE: src/parser/mod.rs
type Parser (line 29) | pub struct Parser<R: Iterator<Item = TokenAndSpan>> {
function new (line 44) | pub fn new(mut it: R) -> Parser<R> {
function parse (line 59) | pub fn parse(mut self) -> PResult<ast::SourceFile> {
function err (line 76) | fn err(&self, kind: ErrorKind) -> Error {
function bump (line 84) | fn bump(&mut self) {
function bump_and_get (line 105) | fn bump_and_get(&mut self) -> Token {
function eat (line 113) | fn eat(&mut self, expected: TokenKind) -> PResult<()> {
function eat_and_get (line 121) | fn eat_and_get(&mut self, expected: TokenKind) -> PResult<(Token)> {
function parse_package_clause (line 131) | fn parse_package_clause(&mut self) -> PResult<String> {
function parse_import_decls (line 142) | fn parse_import_decls(&mut self) -> PResult<Vec<Spanned<ast::ImportDecl>...
function parse_import_decl (line 158) | fn parse_import_decl(&mut self) -> PResult<ast::ImportDecl> {
function parse_import_spec (line 197) | fn parse_import_spec(&mut self) -> PResult<ast::ImportSpec> {
function parse_top_level_decls (line 229) | fn parse_top_level_decls(&mut self) -> PResult<Vec<ast::TopLevelDecl>> {
function parse_func_decl (line 251) | fn parse_func_decl(&mut self) -> PResult<ast::FuncDecl> {
function parse_func_signature (line 279) | fn parse_func_signature(&mut self) -> PResult<ast::FuncSignature> {
function parse_func_params (line 318) | fn parse_func_params(&mut self) -> PResult<ast::Parameters> {
function parse_parameter_decl (line 348) | fn parse_parameter_decl(&mut self) -> PResult<ast::ParameterDecl> {
function parse_type (line 386) | fn parse_type(&mut self) -> PResult<ast::Type> {
function parse_maybe_qualified_ident (line 416) | fn parse_maybe_qualified_ident(&mut self) -> PResult<ast::MaybeQualified...
function parse_block (line 448) | fn parse_block(&mut self) -> PResult<ast::Block> {
function parse_statement (line 466) | fn parse_statement(&mut self) -> PResult<ast::Statement> {
function parse_go_stmt (line 502) | fn parse_go_stmt(&mut self) -> PResult<ast::GoStmt> {
function parse_break_stmt (line 509) | fn parse_break_stmt(&mut self) -> PResult<ast::BreakStmt> {
function parse_continue_stmt (line 522) | fn parse_continue_stmt(&mut self) -> PResult<ast::ContinueStmt> {
function parse_goto_stmt (line 535) | fn parse_goto_stmt(&mut self) -> PResult<ast::GotoStmt> {
function parse_fallthrough_stmt (line 542) | fn parse_fallthrough_stmt(&mut self) -> PResult<ast::FallthroughStmt> {
function parse_defer_stmt (line 549) | fn parse_defer_stmt(&mut self) -> PResult<ast::DeferStmt> {
function parse_return_stmt (line 556) | fn parse_return_stmt(&mut self) -> PResult<ast::ReturnStmt> {
function parse_if_stmt (line 562) | fn parse_if_stmt(&mut self) -> PResult<ast::IfStmt> {
function parse_switch_stmt (line 618) | fn parse_switch_stmt(&mut self) -> PResult<ast::SwitchStmt> {
function parse_select_stmt (line 623) | fn parse_select_stmt(&mut self) -> PResult<ast::SelectStmt> {
function parse_for_stmt (line 628) | fn parse_for_stmt(&mut self) -> PResult<ast::ForStmt> {
function parse_for_header (line 648) | fn parse_for_header(&mut self) -> PResult<ast::ForHeader> {
function expr_list_to_ident_list (line 653) | fn expr_list_to_ident_list(&self,
function parse_simple_stmt (line 688) | fn parse_simple_stmt(&mut self) -> PResult<ast::SimpleStmt> {
function parse_decl_stmt (line 769) | fn parse_decl_stmt(&mut self) -> PResult<ast::SimpleStmt> {
function parse_expr (line 775) | fn parse_expr(&mut self) -> PResult<ast::Expr> {
function parse_expr_list (line 781) | fn parse_expr_list(&mut self) -> PResult<Vec<Spanned<ast::Expr>>> {
function parse_unary_expr (line 799) | fn parse_unary_expr(&mut self) -> PResult<ast::UnaryExpr> {
function parse_selector (line 843) | fn parse_selector(&mut self, x: ast::PrimaryExpr) -> PResult<ast::Select...
function parse_type_assertion (line 869) | fn parse_type_assertion(&mut self, x: ast::PrimaryExpr) -> PResult<ast::...
function parse_primary_expr (line 911) | fn parse_primary_expr(&mut self) -> PResult<ast::PrimaryExpr> {
function parse_operand (line 965) | fn parse_operand(&mut self) -> PResult<ast::Operand> {
function parse_method_expr (line 1001) | fn parse_method_expr(&mut self) -> PResult<ast::MethodExpr> {
function parse_func_lit (line 1005) | fn parse_func_lit(&mut self) -> PResult<ast::FuncLit> {
function parse_index_or_slice (line 1012) | fn parse_index_or_slice(&mut self, x: ast::PrimaryExpr) -> PResult<ast::...
function parse_call_or_conversion (line 1016) | fn parse_call_or_conversion(&mut self, x: ast::PrimaryExpr) -> PResult<a...
function parse_basic_lit (line 1020) | fn parse_basic_lit(&mut self) -> PResult<ast::BasicLit> {
function parse_rune_lit (line 1054) | fn parse_rune_lit(&mut self) -> PResult<char> {
function interpret_float_lit (line 1104) | fn interpret_float_lit(&mut self, value: &str, token_name: &str) -> PRes...
function parse_int_lit (line 1173) | fn parse_int_lit(&mut self) -> PResult<BigInt> {
function interpret_int (line 1210) | fn interpret_int(&mut self, lit: &str, base: u32, token_name: &str) -> P...
function parse_potential_binary_expr (line 1229) | fn parse_potential_binary_expr(&mut self, prec1: i32) -> PResult<ast::Ex...
function parse_ident (line 1267) | fn parse_ident(&mut self) -> PResult<String> {
function parse_string_lit (line 1286) | fn parse_string_lit(&mut self) -> PResult<Vec<u8>> {
function interpret_unicode_escape (line 1316) | fn interpret_unicode_escape(&self,
function interpret_octal_escape (line 1351) | fn interpret_octal_escape(&self, chars: &mut Iterator<Item = (usize, cha...
function interpret_hex_escape (line 1377) | fn interpret_hex_escape(&self, chars: &mut Iterator<Item = (usize, char)...
function get_simple_escape (line 1398) | fn get_simple_escape(&self, c: char) -> Option<u8> {
function interpret_string_lit (line 1421) | fn interpret_string_lit(&mut self, lit: String) -> PResult<Vec<u8>> {
function parse_tokens (line 1472) | pub fn parse_tokens(tokens: Vec<TokenAndSpan>) -> ast::SourceFile {
FILE: src/parser/test.rs
function assert_interpret_string_eq (line 10) | fn assert_interpret_string_eq(lit: &str, expect: Vec<u8>) {
function assert_interpret_string_valid (line 22) | fn assert_interpret_string_valid(lit: &str) {
function test_interpret_strings (line 33) | fn test_interpret_strings() {
function test_interpret_string_illegal_surrogate_half (line 53) | fn test_interpret_string_illegal_surrogate_half() {
function test_interpret_string_invalid_codepoint (line 59) | fn test_interpret_string_invalid_codepoint() {
function assert_interpret_rune_eq (line 65) | fn assert_interpret_rune_eq(lit: &str, expect: char) {
function assert_interpret_rune_valid (line 77) | fn assert_interpret_rune_valid(lit: &str) {
function test_interpret_runes (line 88) | fn test_interpret_runes() {
function test_interpret_rune_too_many_characters (line 109) | fn test_interpret_rune_too_many_characters() {
function test_interpret_rune_too_few_hex_digits (line 115) | fn test_interpret_rune_too_few_hex_digits() {
function test_interpret_rune_too_few_octal_digits (line 121) | fn test_interpret_rune_too_few_octal_digits() {
function test_interpret_rune_surrogate_half (line 127) | fn test_interpret_rune_surrogate_half() {
function test_interpret_rune_invalid_codepoint (line 133) | fn test_interpret_rune_invalid_codepoint() {
function assert_interpret_int_eq (line 139) | fn assert_interpret_int_eq(lit: &str, expect: BigInt) {
function test_interpret_ints (line 152) | fn test_interpret_ints() {
function assert_interpret_float_eq (line 162) | fn assert_interpret_float_eq(lit: &str, expect: BigRational) {
function assert_interpret_imaginary_eq (line 178) | fn assert_interpret_imaginary_eq(lit: &str, expect: BigRational) {
function bigrat_from_int (line 194) | fn bigrat_from_int(value: u64) -> BigRational {
function bigrat_from_ints (line 198) | fn bigrat_from_ints(numerator: u64, denominator: u64) -> BigRational {
function test_interpret_floats (line 204) | fn test_interpret_floats() {
function test_interpret_imaginaries (line 228) | fn test_interpret_imaginaries() {
FILE: src/pos.rs
type Position (line 2) | pub struct Position {
method start (line 10) | pub fn start() -> Position {
FILE: src/token.rs
type TokenAndSpan (line 5) | pub struct TokenAndSpan {
type Span (line 11) | pub struct Span {
type Spanner (line 16) | pub trait Spanner {
method span (line 17) | fn span(&self) -> Span;
method span (line 21) | fn span(&self) -> Span {
method span (line 35) | fn span(&self) -> Span {
method span (line 50) | fn span(&self) -> Span {
type Spanned (line 56) | pub struct Spanned<T: fmt::Debug + Clone + PartialEq + Eq> {
function new (line 62) | pub fn new(span: Span, item: T) -> Spanned<T> {
type Token (line 71) | pub struct Token {
method fmt (line 77) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
type TokenKind (line 87) | pub enum TokenKind {
method fmt (line 241) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
method precedence (line 249) | pub fn precedence(self) -> i32 {
method is_ident (line 266) | pub fn is_ident(self) -> bool {
method is_unary_op (line 270) | pub fn is_unary_op(self) -> bool {
method is_assign_op (line 278) | pub fn is_assign_op(self) -> bool {
method is_literal (line 290) | pub fn is_literal(self) -> bool {
method can_start_statement (line 297) | pub fn can_start_statement(self) -> bool {
method can_start_block (line 322) | pub fn can_start_block(self) -> bool {
method can_start_return_stmt (line 326) | pub fn can_start_return_stmt(self) -> bool {
method can_start_labeled_stmt (line 330) | pub fn can_start_labeled_stmt(self) -> bool {
method can_start_go_stmt (line 336) | pub fn can_start_go_stmt(self) -> bool {
method can_start_decl (line 340) | pub fn can_start_decl(self) -> bool {
method can_start_simple_stmt (line 346) | pub fn can_start_simple_stmt(self) -> bool {
method can_start_expr (line 352) | pub fn can_start_expr(self) -> bool {
method can_start_unary_expr (line 391) | pub fn can_start_unary_expr(self) -> bool {
method can_start_primary_expr (line 395) | pub fn can_start_primary_expr(self) -> bool {
method can_start_operand (line 399) | pub fn can_start_operand(self) -> bool {
method can_start_conversion (line 410) | pub fn can_start_conversion(self) -> bool {
method can_start_type (line 414) | pub fn can_start_type(self) -> bool {
method can_start_type_lit (line 422) | pub fn can_start_type_lit(self) -> bool {
method can_start_pointer_type (line 431) | pub fn can_start_pointer_type(self) -> bool {
method can_start_func_type (line 435) | pub fn can_start_func_type(self) -> bool {
method can_start_interface_type (line 440) | pub fn can_start_interface_type(self) -> bool {
method can_start_chan_type (line 445) | pub fn can_start_chan_type(self) -> bool {
method can_start_lit (line 450) | pub fn can_start_lit(self) -> bool {
method can_start_basic_lit (line 456) | pub fn can_start_basic_lit(self) -> bool {
method can_start_composite_lit (line 460) | pub fn can_start_composite_lit(self) -> bool {
method can_start_lit_type (line 465) | pub fn can_start_lit_type(self) -> bool {
method can_start_func_lit (line 472) | pub fn can_start_func_lit(self) -> bool {
method can_start_struct_type (line 477) | pub fn can_start_struct_type(self) -> bool {
method can_start_array_type (line 481) | pub fn can_start_array_type(self) -> bool {
method can_start_slice_type (line 485) | pub fn can_start_slice_type(self) -> bool {
method can_start_map_type (line 489) | pub fn can_start_map_type(self) -> bool {
method can_start_send_stmt (line 493) | pub fn can_start_send_stmt(self) -> bool {
method can_start_inc_dec_stmt (line 499) | pub fn can_start_inc_dec_stmt(self) -> bool {
method can_start_assignment (line 504) | pub fn can_start_assignment(self) -> bool {
method can_start_short_var_decl (line 510) | pub fn can_start_short_var_decl(self) -> bool {
FILE: tests/data/pass/arithConst_ssa.go
function add_uint64_0_ssa (line 6) | func add_uint64_0_ssa(a uint64) uint64 {
function add_0_uint64_ssa (line 11) | func add_0_uint64_ssa(a uint64) uint64 {
function add_uint64_1_ssa (line 16) | func add_uint64_1_ssa(a uint64) uint64 {
function add_1_uint64_ssa (line 21) | func add_1_uint64_ssa(a uint64) uint64 {
function add_uint64_4294967296_ssa (line 26) | func add_uint64_4294967296_ssa(a uint64) uint64 {
function add_4294967296_uint64_ssa (line 31) | func add_4294967296_uint64_ssa(a uint64) uint64 {
function add_uint64_18446744073709551615_ssa (line 36) | func add_uint64_18446744073709551615_ssa(a uint64) uint64 {
function add_18446744073709551615_uint64_ssa (line 41) | func add_18446744073709551615_uint64_ssa(a uint64) uint64 {
function sub_uint64_0_ssa (line 46) | func sub_uint64_0_ssa(a uint64) uint64 {
function sub_0_uint64_ssa (line 51) | func sub_0_uint64_ssa(a uint64) uint64 {
function sub_uint64_1_ssa (line 56) | func sub_uint64_1_ssa(a uint64) uint64 {
function sub_1_uint64_ssa (line 61) | func sub_1_uint64_ssa(a uint64) uint64 {
function sub_uint64_4294967296_ssa (line 66) | func sub_uint64_4294967296_ssa(a uint64) uint64 {
function sub_4294967296_uint64_ssa (line 71) | func sub_4294967296_uint64_ssa(a uint64) uint64 {
function sub_uint64_18446744073709551615_ssa (line 76) | func sub_uint64_18446744073709551615_ssa(a uint64) uint64 {
function sub_18446744073709551615_uint64_ssa (line 81) | func sub_18446744073709551615_uint64_ssa(a uint64) uint64 {
function div_0_uint64_ssa (line 86) | func div_0_uint64_ssa(a uint64) uint64 {
function div_uint64_1_ssa (line 91) | func div_uint64_1_ssa(a uint64) uint64 {
function div_1_uint64_ssa (line 96) | func div_1_uint64_ssa(a uint64) uint64 {
function div_uint64_4294967296_ssa (line 101) | func div_uint64_4294967296_ssa(a uint64) uint64 {
function div_4294967296_uint64_ssa (line 106) | func div_4294967296_uint64_ssa(a uint64) uint64 {
function div_uint64_18446744073709551615_ssa (line 111) | func div_uint64_18446744073709551615_ssa(a uint64) uint64 {
function div_18446744073709551615_uint64_ssa (line 116) | func div_18446744073709551615_uint64_ssa(a uint64) uint64 {
function mul_uint64_0_ssa (line 121) | func mul_uint64_0_ssa(a uint64) uint64 {
function mul_0_uint64_ssa (line 126) | func mul_0_uint64_ssa(a uint64) uint64 {
function mul_uint64_1_ssa (line 131) | func mul_uint64_1_ssa(a uint64) uint64 {
function mul_1_uint64_ssa (line 136) | func mul_1_uint64_ssa(a uint64) uint64 {
function mul_uint64_4294967296_ssa (line 141) | func mul_uint64_4294967296_ssa(a uint64) uint64 {
function mul_4294967296_uint64_ssa (line 146) | func mul_4294967296_uint64_ssa(a uint64) uint64 {
function mul_uint64_18446744073709551615_ssa (line 151) | func mul_uint64_18446744073709551615_ssa(a uint64) uint64 {
function mul_18446744073709551615_uint64_ssa (line 156) | func mul_18446744073709551615_uint64_ssa(a uint64) uint64 {
function lsh_uint64_0_ssa (line 161) | func lsh_uint64_0_ssa(a uint64) uint64 {
function lsh_0_uint64_ssa (line 166) | func lsh_0_uint64_ssa(a uint64) uint64 {
function lsh_uint64_1_ssa (line 171) | func lsh_uint64_1_ssa(a uint64) uint64 {
function lsh_1_uint64_ssa (line 176) | func lsh_1_uint64_ssa(a uint64) uint64 {
function lsh_uint64_4294967296_ssa (line 181) | func lsh_uint64_4294967296_ssa(a uint64) uint64 {
function lsh_4294967296_uint64_ssa (line 186) | func lsh_4294967296_uint64_ssa(a uint64) uint64 {
function lsh_uint64_18446744073709551615_ssa (line 191) | func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
function lsh_18446744073709551615_uint64_ssa (line 196) | func lsh_18446744073709551615_uint64_ssa(a uint64) uint64 {
function rsh_uint64_0_ssa (line 201) | func rsh_uint64_0_ssa(a uint64) uint64 {
function rsh_0_uint64_ssa (line 206) | func rsh_0_uint64_ssa(a uint64) uint64 {
function rsh_uint64_1_ssa (line 211) | func rsh_uint64_1_ssa(a uint64) uint64 {
function rsh_1_uint64_ssa (line 216) | func rsh_1_uint64_ssa(a uint64) uint64 {
function rsh_uint64_4294967296_ssa (line 221) | func rsh_uint64_4294967296_ssa(a uint64) uint64 {
function rsh_4294967296_uint64_ssa (line 226) | func rsh_4294967296_uint64_ssa(a uint64) uint64 {
function rsh_uint64_18446744073709551615_ssa (line 231) | func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
function rsh_18446744073709551615_uint64_ssa (line 236) | func rsh_18446744073709551615_uint64_ssa(a uint64) uint64 {
function mod_0_uint64_ssa (line 241) | func mod_0_uint64_ssa(a uint64) uint64 {
function mod_uint64_1_ssa (line 246) | func mod_uint64_1_ssa(a uint64) uint64 {
function mod_1_uint64_ssa (line 251) | func mod_1_uint64_ssa(a uint64) uint64 {
function mod_uint64_4294967296_ssa (line 256) | func mod_uint64_4294967296_ssa(a uint64) uint64 {
function mod_4294967296_uint64_ssa (line 261) | func mod_4294967296_uint64_ssa(a uint64) uint64 {
function mod_uint64_18446744073709551615_ssa (line 266) | func mod_uint64_18446744073709551615_ssa(a uint64) uint64 {
function mod_18446744073709551615_uint64_ssa (line 271) | func mod_18446744073709551615_uint64_ssa(a uint64) uint64 {
function add_int64_Neg9223372036854775808_ssa (line 276) | func add_int64_Neg9223372036854775808_ssa(a int64) int64 {
function add_Neg9223372036854775808_int64_ssa (line 281) | func add_Neg9223372036854775808_int64_ssa(a int64) int64 {
function add_int64_Neg9223372036854775807_ssa (line 286) | func add_int64_Neg9223372036854775807_ssa(a int64) int64 {
function add_Neg9223372036854775807_int64_ssa (line 291) | func add_Neg9223372036854775807_int64_ssa(a int64) int64 {
function add_int64_Neg4294967296_ssa (line 296) | func add_int64_Neg4294967296_ssa(a int64) int64 {
function add_Neg4294967296_int64_ssa (line 301) | func add_Neg4294967296_int64_ssa(a int64) int64 {
function add_int64_Neg1_ssa (line 306) | func add_int64_Neg1_ssa(a int64) int64 {
function add_Neg1_int64_ssa (line 311) | func add_Neg1_int64_ssa(a int64) int64 {
function add_int64_0_ssa (line 316) | func add_int64_0_ssa(a int64) int64 {
function add_0_int64_ssa (line 321) | func add_0_int64_ssa(a int64) int64 {
function add_int64_1_ssa (line 326) | func add_int64_1_ssa(a int64) int64 {
function add_1_int64_ssa (line 331) | func add_1_int64_ssa(a int64) int64 {
function add_int64_4294967296_ssa (line 336) | func add_int64_4294967296_ssa(a int64) int64 {
function add_4294967296_int64_ssa (line 341) | func add_4294967296_int64_ssa(a int64) int64 {
function add_int64_9223372036854775806_ssa (line 346) | func add_int64_9223372036854775806_ssa(a int64) int64 {
function add_9223372036854775806_int64_ssa (line 351) | func add_9223372036854775806_int64_ssa(a int64) int64 {
function add_int64_9223372036854775807_ssa (line 356) | func add_int64_9223372036854775807_ssa(a int64) int64 {
function add_9223372036854775807_int64_ssa (line 361) | func add_9223372036854775807_int64_ssa(a int64) int64 {
function sub_int64_Neg9223372036854775808_ssa (line 366) | func sub_int64_Neg9223372036854775808_ssa(a int64) int64 {
function sub_Neg9223372036854775808_int64_ssa (line 371) | func sub_Neg9223372036854775808_int64_ssa(a int64) int64 {
function sub_int64_Neg9223372036854775807_ssa (line 376) | func sub_int64_Neg9223372036854775807_ssa(a int64) int64 {
function sub_Neg9223372036854775807_int64_ssa (line 381) | func sub_Neg9223372036854775807_int64_ssa(a int64) int64 {
function sub_int64_Neg4294967296_ssa (line 386) | func sub_int64_Neg4294967296_ssa(a int64) int64 {
function sub_Neg4294967296_int64_ssa (line 391) | func sub_Neg4294967296_int64_ssa(a int64) int64 {
function sub_int64_Neg1_ssa (line 396) | func sub_int64_Neg1_ssa(a int64) int64 {
function sub_Neg1_int64_ssa (line 401) | func sub_Neg1_int64_ssa(a int64) int64 {
function sub_int64_0_ssa (line 406) | func sub_int64_0_ssa(a int64) int64 {
function sub_0_int64_ssa (line 411) | func sub_0_int64_ssa(a int64) int64 {
function sub_int64_1_ssa (line 416) | func sub_int64_1_ssa(a int64) int64 {
function sub_1_int64_ssa (line 421) | func sub_1_int64_ssa(a int64) int64 {
function sub_int64_4294967296_ssa (line 426) | func sub_int64_4294967296_ssa(a int64) int64 {
function sub_4294967296_int64_ssa (line 431) | func sub_4294967296_int64_ssa(a int64) int64 {
function sub_int64_9223372036854775806_ssa (line 436) | func sub_int64_9223372036854775806_ssa(a int64) int64 {
function sub_9223372036854775806_int64_ssa (line 441) | func sub_9223372036854775806_int64_ssa(a int64) int64 {
function sub_int64_9223372036854775807_ssa (line 446) | func sub_int64_9223372036854775807_ssa(a int64) int64 {
function sub_9223372036854775807_int64_ssa (line 451) | func sub_9223372036854775807_int64_ssa(a int64) int64 {
function div_int64_Neg9223372036854775808_ssa (line 456) | func div_int64_Neg9223372036854775808_ssa(a int64) int64 {
function div_Neg9223372036854775808_int64_ssa (line 461) | func div_Neg9223372036854775808_int64_ssa(a int64) int64 {
function div_int64_Neg9223372036854775807_ssa (line 466) | func div_int64_Neg9223372036854775807_ssa(a int64) int64 {
function div_Neg9223372036854775807_int64_ssa (line 471) | func div_Neg9223372036854775807_int64_ssa(a int64) int64 {
function div_int64_Neg4294967296_ssa (line 476) | func div_int64_Neg4294967296_ssa(a int64) int64 {
function div_Neg4294967296_int64_ssa (line 481) | func div_Neg4294967296_int64_ssa(a int64) int64 {
function div_int64_Neg1_ssa (line 486) | func div_int64_Neg1_ssa(a int64) int64 {
function div_Neg1_int64_ssa (line 491) | func div_Neg1_int64_ssa(a int64) int64 {
function div_0_int64_ssa (line 496) | func div_0_int64_ssa(a int64) int64 {
function div_int64_1_ssa (line 501) | func div_int64_1_ssa(a int64) int64 {
function div_1_int64_ssa (line 506) | func div_1_int64_ssa(a int64) int64 {
function div_int64_4294967296_ssa (line 511) | func div_int64_4294967296_ssa(a int64) int64 {
function div_4294967296_int64_ssa (line 516) | func div_4294967296_int64_ssa(a int64) int64 {
function div_int64_9223372036854775806_ssa (line 521) | func div_int64_9223372036854775806_ssa(a int64) int64 {
function div_9223372036854775806_int64_ssa (line 526) | func div_9223372036854775806_int64_ssa(a int64) int64 {
function div_int64_9223372036854775807_ssa (line 531) | func div_int64_9223372036854775807_ssa(a int64) int64 {
function div_9223372036854775807_int64_ssa (line 536) | func div_9223372036854775807_int64_ssa(a int64) int64 {
function mul_int64_Neg9223372036854775808_ssa (line 541) | func mul_int64_Neg9223372036854775808_ssa(a int64) int64 {
function mul_Neg9223372036854775808_int64_ssa (line 546) | func mul_Neg9223372036854775808_int64_ssa(a int64) int64 {
function mul_int64_Neg9223372036854775807_ssa (line 551) | func mul_int64_Neg9223372036854775807_ssa(a int64) int64 {
function mul_Neg9223372036854775807_int64_ssa (line 556) | func mul_Neg9223372036854775807_int64_ssa(a int64) int64 {
function mul_int64_Neg4294967296_ssa (line 561) | func mul_int64_Neg4294967296_ssa(a int64) int64 {
function mul_Neg4294967296_int64_ssa (line 566) | func mul_Neg4294967296_int64_ssa(a int64) int64 {
function mul_int64_Neg1_ssa (line 571) | func mul_int64_Neg1_ssa(a int64) int64 {
function mul_Neg1_int64_ssa (line 576) | func mul_Neg1_int64_ssa(a int64) int64 {
function mul_int64_0_ssa (line 581) | func mul_int64_0_ssa(a int64) int64 {
function mul_0_int64_ssa (line 586) | func mul_0_int64_ssa(a int64) int64 {
function mul_int64_1_ssa (line 591) | func mul_int64_1_ssa(a int64) int64 {
function mul_1_int64_ssa (line 596) | func mul_1_int64_ssa(a int64) int64 {
function mul_int64_4294967296_ssa (line 601) | func mul_int64_4294967296_ssa(a int64) int64 {
function mul_4294967296_int64_ssa (line 606) | func mul_4294967296_int64_ssa(a int64) int64 {
function mul_int64_9223372036854775806_ssa (line 611) | func mul_int64_9223372036854775806_ssa(a int64) int64 {
function mul_9223372036854775806_int64_ssa (line 616) | func mul_9223372036854775806_int64_ssa(a int64) int64 {
function mul_int64_9223372036854775807_ssa (line 621) | func mul_int64_9223372036854775807_ssa(a int64) int64 {
function mul_9223372036854775807_int64_ssa (line 626) | func mul_9223372036854775807_int64_ssa(a int64) int64 {
function mod_int64_Neg9223372036854775808_ssa (line 631) | func mod_int64_Neg9223372036854775808_ssa(a int64) int64 {
function mod_Neg9223372036854775808_int64_ssa (line 636) | func mod_Neg9223372036854775808_int64_ssa(a int64) int64 {
function mod_int64_Neg9223372036854775807_ssa (line 641) | func mod_int64_Neg9223372036854775807_ssa(a int64) int64 {
function mod_Neg9223372036854775807_int64_ssa (line 646) | func mod_Neg9223372036854775807_int64_ssa(a int64) int64 {
function mod_int64_Neg4294967296_ssa (line 651) | func mod_int64_Neg4294967296_ssa(a int64) int64 {
function mod_Neg4294967296_int64_ssa (line 656) | func mod_Neg4294967296_int64_ssa(a int64) int64 {
function mod_int64_Neg1_ssa (line 661) | func mod_int64_Neg1_ssa(a int64) int64 {
function mod_Neg1_int64_ssa (line 666) | func mod_Neg1_int64_ssa(a int64) int64 {
function mod_0_int64_ssa (line 671) | func mod_0_int64_ssa(a int64) int64 {
function mod_int64_1_ssa (line 676) | func mod_int64_1_ssa(a int64) int64 {
function mod_1_int64_ssa (line 681) | func mod_1_int64_ssa(a int64) int64 {
function mod_int64_4294967296_ssa (line 686) | func mod_int64_4294967296_ssa(a int64) int64 {
function mod_4294967296_int64_ssa (line 691) | func mod_4294967296_int64_ssa(a int64) int64 {
function mod_int64_9223372036854775806_ssa (line 696) | func mod_int64_9223372036854775806_ssa(a int64) int64 {
function mod_9223372036854775806_int64_ssa (line 701) | func mod_9223372036854775806_int64_ssa(a int64) int64 {
function mod_int64_9223372036854775807_ssa (line 706) | func mod_int64_9223372036854775807_ssa(a int64) int64 {
function mod_9223372036854775807_int64_ssa (line 711) | func mod_9223372036854775807_int64_ssa(a int64) int64 {
function add_uint32_0_ssa (line 716) | func add_uint32_0_ssa(a uint32) uint32 {
function add_0_uint32_ssa (line 721) | func add_0_uint32_ssa(a uint32) uint32 {
function add_uint32_1_ssa (line 726) | func add_uint32_1_ssa(a uint32) uint32 {
function add_1_uint32_ssa (line 731) | func add_1_uint32_ssa(a uint32) uint32 {
function add_uint32_4294967295_ssa (line 736) | func add_uint32_4294967295_ssa(a uint32) uint32 {
function add_4294967295_uint32_ssa (line 741) | func add_4294967295_uint32_ssa(a uint32) uint32 {
function sub_uint32_0_ssa (line 746) | func sub_uint32_0_ssa(a uint32) uint32 {
function sub_0_uint32_ssa (line 751) | func sub_0_uint32_ssa(a uint32) uint32 {
function sub_uint32_1_ssa (line 756) | func sub_uint32_1_ssa(a uint32) uint32 {
function sub_1_uint32_ssa (line 761) | func sub_1_uint32_ssa(a uint32) uint32 {
function sub_uint32_4294967295_ssa (line 766) | func sub_uint32_4294967295_ssa(a uint32) uint32 {
function sub_4294967295_uint32_ssa (line 771) | func sub_4294967295_uint32_ssa(a uint32) uint32 {
function div_0_uint32_ssa (line 776) | func div_0_uint32_ssa(a uint32) uint32 {
function div_uint32_1_ssa (line 781) | func div_uint32_1_ssa(a uint32) uint32 {
function div_1_uint32_ssa (line 786) | func div_1_uint32_ssa(a uint32) uint32 {
function div_uint32_4294967295_ssa (line 791) | func div_uint32_4294967295_ssa(a uint32) uint32 {
function div_4294967295_uint32_ssa (line 796) | func div_4294967295_uint32_ssa(a uint32) uint32 {
function mul_uint32_0_ssa (line 801) | func mul_uint32_0_ssa(a uint32) uint32 {
function mul_0_uint32_ssa (line 806) | func mul_0_uint32_ssa(a uint32) uint32 {
function mul_uint32_1_ssa (line 811) | func mul_uint32_1_ssa(a uint32) uint32 {
function mul_1_uint32_ssa (line 816) | func mul_1_uint32_ssa(a uint32) uint32 {
function mul_uint32_4294967295_ssa (line 821) | func mul_uint32_4294967295_ssa(a uint32) uint32 {
function mul_4294967295_uint32_ssa (line 826) | func mul_4294967295_uint32_ssa(a uint32) uint32 {
function lsh_uint32_0_ssa (line 831) | func lsh_uint32_0_ssa(a uint32) uint32 {
function lsh_0_uint32_ssa (line 836) | func lsh_0_uint32_ssa(a uint32) uint32 {
function lsh_uint32_1_ssa (line 841) | func lsh_uint32_1_ssa(a uint32) uint32 {
function lsh_1_uint32_ssa (line 846) | func lsh_1_uint32_ssa(a uint32) uint32 {
function lsh_uint32_4294967295_ssa (line 851) | func lsh_uint32_4294967295_ssa(a uint32) uint32 {
function lsh_4294967295_uint32_ssa (line 856) | func lsh_4294967295_uint32_ssa(a uint32) uint32 {
function rsh_uint32_0_ssa (line 861) | func rsh_uint32_0_ssa(a uint32) uint32 {
function rsh_0_uint32_ssa (line 866) | func rsh_0_uint32_ssa(a uint32) uint32 {
function rsh_uint32_1_ssa (line 871) | func rsh_uint32_1_ssa(a uint32) uint32 {
function rsh_1_uint32_ssa (line 876) | func rsh_1_uint32_ssa(a uint32) uint32 {
function rsh_uint32_4294967295_ssa (line 881) | func rsh_uint32_4294967295_ssa(a uint32) uint32 {
function rsh_4294967295_uint32_ssa (line 886) | func rsh_4294967295_uint32_ssa(a uint32) uint32 {
function mod_0_uint32_ssa (line 891) | func mod_0_uint32_ssa(a uint32) uint32 {
function mod_uint32_1_ssa (line 896) | func mod_uint32_1_ssa(a uint32) uint32 {
function mod_1_uint32_ssa (line 901) | func mod_1_uint32_ssa(a uint32) uint32 {
function mod_uint32_4294967295_ssa (line 906) | func mod_uint32_4294967295_ssa(a uint32) uint32 {
function mod_4294967295_uint32_ssa (line 911) | func mod_4294967295_uint32_ssa(a uint32) uint32 {
function add_int32_Neg2147483648_ssa (line 916) | func add_int32_Neg2147483648_ssa(a int32) int32 {
function add_Neg2147483648_int32_ssa (line 921) | func add_Neg2147483648_int32_ssa(a int32) int32 {
function add_int32_Neg2147483647_ssa (line 926) | func add_int32_Neg2147483647_ssa(a int32) int32 {
function add_Neg2147483647_int32_ssa (line 931) | func add_Neg2147483647_int32_ssa(a int32) int32 {
function add_int32_Neg1_ssa (line 936) | func add_int32_Neg1_ssa(a int32) int32 {
function add_Neg1_int32_ssa (line 941) | func add_Neg1_int32_ssa(a int32) int32 {
function add_int32_0_ssa (line 946) | func add_int32_0_ssa(a int32) int32 {
function add_0_int32_ssa (line 951) | func add_0_int32_ssa(a int32) int32 {
function add_int32_1_ssa (line 956) | func add_int32_1_ssa(a int32) int32 {
function add_1_int32_ssa (line 961) | func add_1_int32_ssa(a int32) int32 {
function add_int32_2147483647_ssa (line 966) | func add_int32_2147483647_ssa(a int32) int32 {
function add_2147483647_int32_ssa (line 971) | func add_2147483647_int32_ssa(a int32) int32 {
function sub_int32_Neg2147483648_ssa (line 976) | func sub_int32_Neg2147483648_ssa(a int32) int32 {
function sub_Neg2147483648_int32_ssa (line 981) | func sub_Neg2147483648_int32_ssa(a int32) int32 {
function sub_int32_Neg2147483647_ssa (line 986) | func sub_int32_Neg2147483647_ssa(a int32) int32 {
function sub_Neg2147483647_int32_ssa (line 991) | func sub_Neg2147483647_int32_ssa(a int32) int32 {
function sub_int32_Neg1_ssa (line 996) | func sub_int32_Neg1_ssa(a int32) int32 {
function sub_Neg1_int32_ssa (line 1001) | func sub_Neg1_int32_ssa(a int32) int32 {
function sub_int32_0_ssa (line 1006) | func sub_int32_0_ssa(a int32) int32 {
function sub_0_int32_ssa (line 1011) | func sub_0_int32_ssa(a int32) int32 {
function sub_int32_1_ssa (line 1016) | func sub_int32_1_ssa(a int32) int32 {
function sub_1_int32_ssa (line 1021) | func sub_1_int32_ssa(a int32) int32 {
function sub_int32_2147483647_ssa (line 1026) | func sub_int32_2147483647_ssa(a int32) int32 {
function sub_2147483647_int32_ssa (line 1031) | func sub_2147483647_int32_ssa(a int32) int32 {
function div_int32_Neg2147483648_ssa (line 1036) | func div_int32_Neg2147483648_ssa(a int32) int32 {
function div_Neg2147483648_int32_ssa (line 1041) | func div_Neg2147483648_int32_ssa(a int32) int32 {
function div_int32_Neg2147483647_ssa (line 1046) | func div_int32_Neg2147483647_ssa(a int32) int32 {
function div_Neg2147483647_int32_ssa (line 1051) | func div_Neg2147483647_int32_ssa(a int32) int32 {
function div_int32_Neg1_ssa (line 1056) | func div_int32_Neg1_ssa(a int32) int32 {
function div_Neg1_int32_ssa (line 1061) | func div_Neg1_int32_ssa(a int32) int32 {
function div_0_int32_ssa (line 1066) | func div_0_int32_ssa(a int32) int32 {
function div_int32_1_ssa (line 1071) | func div_int32_1_ssa(a int32) int32 {
function div_1_int32_ssa (line 1076) | func div_1_int32_ssa(a int32) int32 {
function div_int32_2147483647_ssa (line 1081) | func div_int32_2147483647_ssa(a int32) int32 {
function div_2147483647_int32_ssa (line 1086) | func div_2147483647_int32_ssa(a int32) int32 {
function mul_int32_Neg2147483648_ssa (line 1091) | func mul_int32_Neg2147483648_ssa(a int32) int32 {
function mul_Neg2147483648_int32_ssa (line 1096) | func mul_Neg2147483648_int32_ssa(a int32) int32 {
function mul_int32_Neg2147483647_ssa (line 1101) | func mul_int32_Neg2147483647_ssa(a int32) int32 {
function mul_Neg2147483647_int32_ssa (line 1106) | func mul_Neg2147483647_int32_ssa(a int32) int32 {
function mul_int32_Neg1_ssa (line 1111) | func mul_int32_Neg1_ssa(a int32) int32 {
function mul_Neg1_int32_ssa (line 1116) | func mul_Neg1_int32_ssa(a int32) int32 {
function mul_int32_0_ssa (line 1121) | func mul_int32_0_ssa(a int32) int32 {
function mul_0_int32_ssa (line 1126) | func mul_0_int32_ssa(a int32) int32 {
function mul_int32_1_ssa (line 1131) | func mul_int32_1_ssa(a int32) int32 {
function mul_1_int32_ssa (line 1136) | func mul_1_int32_ssa(a int32) int32 {
function mul_int32_2147483647_ssa (line 1141) | func mul_int32_2147483647_ssa(a int32) int32 {
function mul_2147483647_int32_ssa (line 1146) | func mul_2147483647_int32_ssa(a int32) int32 {
function mod_int32_Neg2147483648_ssa (line 1151) | func mod_int32_Neg2147483648_ssa(a int32) int32 {
function mod_Neg2147483648_int32_ssa (line 1156) | func mod_Neg2147483648_int32_ssa(a int32) int32 {
function mod_int32_Neg2147483647_ssa (line 1161) | func mod_int32_Neg2147483647_ssa(a int32) int32 {
function mod_Neg2147483647_int32_ssa (line 1166) | func mod_Neg2147483647_int32_ssa(a int32) int32 {
function mod_int32_Neg1_ssa (line 1171) | func mod_int32_Neg1_ssa(a int32) int32 {
function mod_Neg1_int32_ssa (line 1176) | func mod_Neg1_int32_ssa(a int32) int32 {
function mod_0_int32_ssa (line 1181) | func mod_0_int32_ssa(a int32) int32 {
function mod_int32_1_ssa (line 1186) | func mod_int32_1_ssa(a int32) int32 {
function mod_1_int32_ssa (line 1191) | func mod_1_int32_ssa(a int32) int32 {
function mod_int32_2147483647_ssa (line 1196) | func mod_int32_2147483647_ssa(a int32) int32 {
function mod_2147483647_int32_ssa (line 1201) | func mod_2147483647_int32_ssa(a int32) int32 {
function add_uint16_0_ssa (line 1206) | func add_uint16_0_ssa(a uint16) uint16 {
function add_0_uint16_ssa (line 1211) | func add_0_uint16_ssa(a uint16) uint16 {
function add_uint16_1_ssa (line 1216) | func add_uint16_1_ssa(a uint16) uint16 {
function add_1_uint16_ssa (line 1221) | func add_1_uint16_ssa(a uint16) uint16 {
function add_uint16_65535_ssa (line 1226) | func add_uint16_65535_ssa(a uint16) uint16 {
function add_65535_uint16_ssa (line 1231) | func add_65535_uint16_ssa(a uint16) uint16 {
function sub_uint16_0_ssa (line 1236) | func sub_uint16_0_ssa(a uint16) uint16 {
function sub_0_uint16_ssa (line 1241) | func sub_0_uint16_ssa(a uint16) uint16 {
function sub_uint16_1_ssa (line 1246) | func sub_uint16_1_ssa(a uint16) uint16 {
function sub_1_uint16_ssa (line 1251) | func sub_1_uint16_ssa(a uint16) uint16 {
function sub_uint16_65535_ssa (line 1256) | func sub_uint16_65535_ssa(a uint16) uint16 {
function sub_65535_uint16_ssa (line 1261) | func sub_65535_uint16_ssa(a uint16) uint16 {
function div_0_uint16_ssa (line 1266) | func div_0_uint16_ssa(a uint16) uint16 {
function div_uint16_1_ssa (line 1271) | func div_uint16_1_ssa(a uint16) uint16 {
function div_1_uint16_ssa (line 1276) | func div_1_uint16_ssa(a uint16) uint16 {
function div_uint16_65535_ssa (line 1281) | func div_uint16_65535_ssa(a uint16) uint16 {
function div_65535_uint16_ssa (line 1286) | func div_65535_uint16_ssa(a uint16) uint16 {
function mul_uint16_0_ssa (line 1291) | func mul_uint16_0_ssa(a uint16) uint16 {
function mul_0_uint16_ssa (line 1296) | func mul_0_uint16_ssa(a uint16) uint16 {
function mul_uint16_1_ssa (line 1301) | func mul_uint16_1_ssa(a uint16) uint16 {
function mul_1_uint16_ssa (line 1306) | func mul_1_uint16_ssa(a uint16) uint16 {
function mul_uint16_65535_ssa (line 1311) | func mul_uint16_65535_ssa(a uint16) uint16 {
function mul_65535_uint16_ssa (line 1316) | func mul_65535_uint16_ssa(a uint16) uint16 {
function lsh_uint16_0_ssa (line 1321) | func lsh_uint16_0_ssa(a uint16) uint16 {
function lsh_0_uint16_ssa (line 1326) | func lsh_0_uint16_ssa(a uint16) uint16 {
function lsh_uint16_1_ssa (line 1331) | func lsh_uint16_1_ssa(a uint16) uint16 {
function lsh_1_uint16_ssa (line 1336) | func lsh_1_uint16_ssa(a uint16) uint16 {
function lsh_uint16_65535_ssa (line 1341) | func lsh_uint16_65535_ssa(a uint16) uint16 {
function lsh_65535_uint16_ssa (line 1346) | func lsh_65535_uint16_ssa(a uint16) uint16 {
function rsh_uint16_0_ssa (line 1351) | func rsh_uint16_0_ssa(a uint16) uint16 {
function rsh_0_uint16_ssa (line 1356) | func rsh_0_uint16_ssa(a uint16) uint16 {
function rsh_uint16_1_ssa (line 1361) | func rsh_uint16_1_ssa(a uint16) uint16 {
function rsh_1_uint16_ssa (line 1366) | func rsh_1_uint16_ssa(a uint16) uint16 {
function rsh_uint16_65535_ssa (line 1371) | func rsh_uint16_65535_ssa(a uint16) uint16 {
function rsh_65535_uint16_ssa (line 1376) | func rsh_65535_uint16_ssa(a uint16) uint16 {
function mod_0_uint16_ssa (line 1381) | func mod_0_uint16_ssa(a uint16) uint16 {
function mod_uint16_1_ssa (line 1386) | func mod_uint16_1_ssa(a uint16) uint16 {
function mod_1_uint16_ssa (line 1391) | func mod_1_uint16_ssa(a uint16) uint16 {
function mod_uint16_65535_ssa (line 1396) | func mod_uint16_65535_ssa(a uint16) uint16 {
function mod_65535_uint16_ssa (line 1401) | func mod_65535_uint16_ssa(a uint16) uint16 {
function add_int16_Neg32768_ssa (line 1406) | func add_int16_Neg32768_ssa(a int16) int16 {
function add_Neg32768_int16_ssa (line 1411) | func add_Neg32768_int16_ssa(a int16) int16 {
function add_int16_Neg32767_ssa (line 1416) | func add_int16_Neg32767_ssa(a int16) int16 {
function add_Neg32767_int16_ssa (line 1421) | func add_Neg32767_int16_ssa(a int16) int16 {
function add_int16_Neg1_ssa (line 1426) | func add_int16_Neg1_ssa(a int16) int16 {
function add_Neg1_int16_ssa (line 1431) | func add_Neg1_int16_ssa(a int16) int16 {
function add_int16_0_ssa (line 1436) | func add_int16_0_ssa(a int16) int16 {
function add_0_int16_ssa (line 1441) | func add_0_int16_ssa(a int16) int16 {
function add_int16_1_ssa (line 1446) | func add_int16_1_ssa(a int16) int16 {
function add_1_int16_ssa (line 1451) | func add_1_int16_ssa(a int16) int16 {
function add_int16_32766_ssa (line 1456) | func add_int16_32766_ssa(a int16) int16 {
function add_32766_int16_ssa (line 1461) | func add_32766_int16_ssa(a int16) int16 {
function add_int16_32767_ssa (line 1466) | func add_int16_32767_ssa(a int16) int16 {
function add_32767_int16_ssa (line 1471) | func add_32767_int16_ssa(a int16) int16 {
function sub_int16_Neg32768_ssa (line 1476) | func sub_int16_Neg32768_ssa(a int16) int16 {
function sub_Neg32768_int16_ssa (line 1481) | func sub_Neg32768_int16_ssa(a int16) int16 {
function sub_int16_Neg32767_ssa (line 1486) | func sub_int16_Neg32767_ssa(a int16) int16 {
function sub_Neg32767_int16_ssa (line 1491) | func sub_Neg32767_int16_ssa(a int16) int16 {
function sub_int16_Neg1_ssa (line 1496) | func sub_int16_Neg1_ssa(a int16) int16 {
function sub_Neg1_int16_ssa (line 1501) | func sub_Neg1_int16_ssa(a int16) int16 {
function sub_int16_0_ssa (line 1506) | func sub_int16_0_ssa(a int16) int16 {
function sub_0_int16_ssa (line 1511) | func sub_0_int16_ssa(a int16) int16 {
function sub_int16_1_ssa (line 1516) | func sub_int16_1_ssa(a int16) int16 {
function sub_1_int16_ssa (line 1521) | func sub_1_int16_ssa(a int16) int16 {
function sub_int16_32766_ssa (line 1526) | func sub_int16_32766_ssa(a int16) int16 {
function sub_32766_int16_ssa (line 1531) | func sub_32766_int16_ssa(a int16) int16 {
function sub_int16_32767_ssa (line 1536) | func sub_int16_32767_ssa(a int16) int16 {
function sub_32767_int16_ssa (line 1541) | func sub_32767_int16_ssa(a int16) int16 {
function div_int16_Neg32768_ssa (line 1546) | func div_int16_Neg32768_ssa(a int16) int16 {
function div_Neg32768_int16_ssa (line 1551) | func div_Neg32768_int16_ssa(a int16) int16 {
function div_int16_Neg32767_ssa (line 1556) | func div_int16_Neg32767_ssa(a int16) int16 {
function div_Neg32767_int16_ssa (line 1561) | func div_Neg32767_int16_ssa(a int16) int16 {
function div_int16_Neg1_ssa (line 1566) | func div_int16_Neg1_ssa(a int16) int16 {
function div_Neg1_int16_ssa (line 1571) | func div_Neg1_int16_ssa(a int16) int16 {
function div_0_int16_ssa (line 1576) | func div_0_int16_ssa(a int16) int16 {
function div_int16_1_ssa (line 1581) | func div_int16_1_ssa(a int16) int16 {
function div_1_int16_ssa (line 1586) | func div_1_int16_ssa(a int16) int16 {
function div_int16_32766_ssa (line 1591) | func div_int16_32766_ssa(a int16) int16 {
function div_32766_int16_ssa (line 1596) | func div_32766_int16_ssa(a int16) int16 {
function div_int16_32767_ssa (line 1601) | func div_int16_32767_ssa(a int16) int16 {
function div_32767_int16_ssa (line 1606) | func div_32767_int16_ssa(a int16) int16 {
function mul_int16_Neg32768_ssa (line 1611) | func mul_int16_Neg32768_ssa(a int16) int16 {
function mul_Neg32768_int16_ssa (line 1616) | func mul_Neg32768_int16_ssa(a int16) int16 {
function mul_int16_Neg32767_ssa (line 1621) | func mul_int16_Neg32767_ssa(a int16) int16 {
function mul_Neg32767_int16_ssa (line 1626) | func mul_Neg32767_int16_ssa(a int16) int16 {
function mul_int16_Neg1_ssa (line 1631) | func mul_int16_Neg1_ssa(a int16) int16 {
function mul_Neg1_int16_ssa (line 1636) | func mul_Neg1_int16_ssa(a int16) int16 {
function mul_int16_0_ssa (line 1641) | func mul_int16_0_ssa(a int16) int16 {
function mul_0_int16_ssa (line 1646) | func mul_0_int16_ssa(a int16) int16 {
function mul_int16_1_ssa (line 1651) | func mul_int16_1_ssa(a int16) int16 {
function mul_1_int16_ssa (line 1656) | func mul_1_int16_ssa(a int16) int16 {
function mul_int16_32766_ssa (line 1661) | func mul_int16_32766_ssa(a int16) int16 {
function mul_32766_int16_ssa (line 1666) | func mul_32766_int16_ssa(a int16) int16 {
function mul_int16_32767_ssa (line 1671) | func mul_int16_32767_ssa(a int16) int16 {
function mul_32767_int16_ssa (line 1676) | func mul_32767_int16_ssa(a int16) int16 {
function mod_int16_Neg32768_ssa (line 1681) | func mod_int16_Neg32768_ssa(a int16) int16 {
function mod_Neg32768_int16_ssa (line 1686) | func mod_Neg32768_int16_ssa(a int16) int16 {
function mod_int16_Neg32767_ssa (line 1691) | func mod_int16_Neg32767_ssa(a int16) int16 {
function mod_Neg32767_int16_ssa (line 1696) | func mod_Neg32767_int16_ssa(a int16) int16 {
function mod_int16_Neg1_ssa (line 1701) | func mod_int16_Neg1_ssa(a int16) int16 {
function mod_Neg1_int16_ssa (line 1706) | func mod_Neg1_int16_ssa(a int16) int16 {
function mod_0_int16_ssa (line 1711) | func mod_0_int16_ssa(a int16) int16 {
function mod_int16_1_ssa (line 1716) | func mod_int16_1_ssa(a int16) int16 {
function mod_1_int16_ssa (line 1721) | func mod_1_int16_ssa(a int16) int16 {
function mod_int16_32766_ssa (line 1726) | func mod_int16_32766_ssa(a int16) int16 {
function mod_32766_int16_ssa (line 1731) | func mod_32766_int16_ssa(a int16) int16 {
function mod_int16_32767_ssa (line 1736) | func mod_int16_32767_ssa(a int16) int16 {
function mod_32767_int16_ssa (line 1741) | func mod_32767_int16_ssa(a int16) int16 {
function add_uint8_0_ssa (line 1746) | func add_uint8_0_ssa(a uint8) uint8 {
function add_0_uint8_ssa (line 1751) | func add_0_uint8_ssa(a uint8) uint8 {
function add_uint8_1_ssa (line 1756) | func add_uint8_1_ssa(a uint8) uint8 {
function add_1_uint8_ssa (line 1761) | func add_1_uint8_ssa(a uint8) uint8 {
function add_uint8_255_ssa (line 1766) | func add_uint8_255_ssa(a uint8) uint8 {
function add_255_uint8_ssa (line 1771) | func add_255_uint8_ssa(a uint8) uint8 {
function sub_uint8_0_ssa (line 1776) | func sub_uint8_0_ssa(a uint8) uint8 {
function sub_0_uint8_ssa (line 1781) | func sub_0_uint8_ssa(a uint8) uint8 {
function sub_uint8_1_ssa (line 1786) | func sub_uint8_1_ssa(a uint8) uint8 {
function sub_1_uint8_ssa (line 1791) | func sub_1_uint8_ssa(a uint8) uint8 {
function sub_uint8_255_ssa (line 1796) | func sub_uint8_255_ssa(a uint8) uint8 {
function sub_255_uint8_ssa (line 1801) | func sub_255_uint8_ssa(a uint8) uint8 {
function div_0_uint8_ssa (line 1806) | func div_0_uint8_ssa(a uint8) uint8 {
function div_uint8_1_ssa (line 1811) | func div_uint8_1_ssa(a uint8) uint8 {
function div_1_uint8_ssa (line 1816) | func div_1_uint8_ssa(a uint8) uint8 {
function div_uint8_255_ssa (line 1821) | func div_uint8_255_ssa(a uint8) uint8 {
function div_255_uint8_ssa (line 1826) | func div_255_uint8_ssa(a uint8) uint8 {
function mul_uint8_0_ssa (line 1831) | func mul_uint8_0_ssa(a uint8) uint8 {
function mul_0_uint8_ssa (line 1836) | func mul_0_uint8_ssa(a uint8) uint8 {
function mul_uint8_1_ssa (line 1841) | func mul_uint8_1_ssa(a uint8) uint8 {
function mul_1_uint8_ssa (line 1846) | func mul_1_uint8_ssa(a uint8) uint8 {
function mul_uint8_255_ssa (line 1851) | func mul_uint8_255_ssa(a uint8) uint8 {
function mul_255_uint8_ssa (line 1856) | func mul_255_uint8_ssa(a uint8) uint8 {
function lsh_uint8_0_ssa (line 1861) | func lsh_uint8_0_ssa(a uint8) uint8 {
function lsh_0_uint8_ssa (line 1866) | func lsh_0_uint8_ssa(a uint8) uint8 {
function lsh_uint8_1_ssa (line 1871) | func lsh_uint8_1_ssa(a uint8) uint8 {
function lsh_1_uint8_ssa (line 1876) | func lsh_1_uint8_ssa(a uint8) uint8 {
function lsh_uint8_255_ssa (line 1881) | func lsh_uint8_255_ssa(a uint8) uint8 {
function lsh_255_uint8_ssa (line 1886) | func lsh_255_uint8_ssa(a uint8) uint8 {
function rsh_uint8_0_ssa (line 1891) | func rsh_uint8_0_ssa(a uint8) uint8 {
function rsh_0_uint8_ssa (line 1896) | func rsh_0_uint8_ssa(a uint8) uint8 {
function rsh_uint8_1_ssa (line 1901) | func rsh_uint8_1_ssa(a uint8) uint8 {
function rsh_1_uint8_ssa (line 1906) | func rsh_1_uint8_ssa(a uint8) uint8 {
function rsh_uint8_255_ssa (line 1911) | func rsh_uint8_255_ssa(a uint8) uint8 {
function rsh_255_uint8_ssa (line 1916) | func rsh_255_uint8_ssa(a uint8) uint8 {
function mod_0_uint8_ssa (line 1921) | func mod_0_uint8_ssa(a uint8) uint8 {
function mod_uint8_1_ssa (line 1926) | func mod_uint8_1_ssa(a uint8) uint8 {
function mod_1_uint8_ssa (line 1931) | func mod_1_uint8_ssa(a uint8) uint8 {
function mod_uint8_255_ssa (line 1936) | func mod_uint8_255_ssa(a uint8) uint8 {
function mod_255_uint8_ssa (line 1941) | func mod_255_uint8_ssa(a uint8) uint8 {
function add_int8_Neg128_ssa (line 1946) | func add_int8_Neg128_ssa(a int8) int8 {
function add_Neg128_int8_ssa (line 1951) | func add_Neg128_int8_ssa(a int8) int8 {
function add_int8_Neg127_ssa (line 1956) | func add_int8_Neg127_ssa(a int8) int8 {
function add_Neg127_int8_ssa (line 1961) | func add_Neg127_int8_ssa(a int8) int8 {
function add_int8_Neg1_ssa (line 1966) | func add_int8_Neg1_ssa(a int8) int8 {
function add_Neg1_int8_ssa (line 1971) | func add_Neg1_int8_ssa(a int8) int8 {
function add_int8_0_ssa (line 1976) | func add_int8_0_ssa(a int8) int8 {
function add_0_int8_ssa (line 1981) | func add_0_int8_ssa(a int8) int8 {
function add_int8_1_ssa (line 1986) | func add_int8_1_ssa(a int8) int8 {
function add_1_int8_ssa (line 1991) | func add_1_int8_ssa(a int8) int8 {
function add_int8_126_ssa (line 1996) | func add_int8_126_ssa(a int8) int8 {
function add_126_int8_ssa (line 2001) | func add_126_int8_ssa(a int8) int8 {
function add_int8_127_ssa (line 2006) | func add_int8_127_ssa(a int8) int8 {
function add_127_int8_ssa (line 2011) | func add_127_int8_ssa(a int8) int8 {
function sub_int8_Neg128_ssa (line 2016) | func sub_int8_Neg128_ssa(a int8) int8 {
function sub_Neg128_int8_ssa (line 2021) | func sub_Neg128_int8_ssa(a int8) int8 {
function sub_int8_Neg127_ssa (line 2026) | func sub_int8_Neg127_ssa(a int8) int8 {
function sub_Neg127_int8_ssa (line 2031) | func sub_Neg127_int8_ssa(a int8) int8 {
function sub_int8_Neg1_ssa (line 2036) | func sub_int8_Neg1_ssa(a int8) int8 {
function sub_Neg1_int8_ssa (line 2041) | func sub_Neg1_int8_ssa(a int8) int8 {
function sub_int8_0_ssa (line 2046) | func sub_int8_0_ssa(a int8) int8 {
function sub_0_int8_ssa (line 2051) | func sub_0_int8_ssa(a int8) int8 {
function sub_int8_1_ssa (line 2056) | func sub_int8_1_ssa(a int8) int8 {
function sub_1_int8_ssa (line 2061) | func sub_1_int8_ssa(a int8) int8 {
function sub_int8_126_ssa (line 2066) | func sub_int8_126_ssa(a int8) int8 {
function sub_126_int8_ssa (line 2071) | func sub_126_int8_ssa(a int8) int8 {
function sub_int8_127_ssa (line 2076) | func sub_int8_127_ssa(a int8) int8 {
function sub_127_int8_ssa (line 2081) | func sub_127_int8_ssa(a int8) int8 {
function div_int8_Neg128_ssa (line 2086) | func div_int8_Neg128_ssa(a int8) int8 {
function div_Neg128_int8_ssa (line 2091) | func div_Neg128_int8_ssa(a int8) int8 {
function div_int8_Neg127_ssa (line 2096) | func div_int8_Neg127_ssa(a int8) int8 {
function div_Neg127_int8_ssa (line 2101) | func div_Neg127_int8_ssa(a int8) int8 {
function div_int8_Neg1_ssa (line 2106) | func div_int8_Neg1_ssa(a int8) int8 {
function div_Neg1_int8_ssa (line 2111) | func div_Neg1_int8_ssa(a int8) int8 {
function div_0_int8_ssa (line 2116) | func div_0_int8_ssa(a int8) int8 {
function div_int8_1_ssa (line 2121) | func div_int8_1_ssa(a int8) int8 {
function div_1_int8_ssa (line 2126) | func div_1_int8_ssa(a int8) int8 {
function div_int8_126_ssa (line 2131) | func div_int8_126_ssa(a int8) int8 {
function div_126_int8_ssa (line 2136) | func div_126_int8_ssa(a int8) int8 {
function div_int8_127_ssa (line 2141) | func div_int8_127_ssa(a int8) int8 {
function div_127_int8_ssa (line 2146) | func div_127_int8_ssa(a int8) int8 {
function mul_int8_Neg128_ssa (line 2151) | func mul_int8_Neg128_ssa(a int8) int8 {
function mul_Neg128_int8_ssa (line 2156) | func mul_Neg128_int8_ssa(a int8) int8 {
function mul_int8_Neg127_ssa (line 2161) | func mul_int8_Neg127_ssa(a int8) int8 {
function mul_Neg127_int8_ssa (line 2166) | func mul_Neg127_int8_ssa(a int8) int8 {
function mul_int8_Neg1_ssa (line 2171) | func mul_int8_Neg1_ssa(a int8) int8 {
function mul_Neg1_int8_ssa (line 2176) | func mul_Neg1_int8_ssa(a int8) int8 {
function mul_int8_0_ssa (line 2181) | func mul_int8_0_ssa(a int8) int8 {
function mul_0_int8_ssa (line 2186) | func mul_0_int8_ssa(a int8) int8 {
function mul_int8_1_ssa (line 2191) | func mul_int8_1_ssa(a int8) int8 {
function mul_1_int8_ssa (line 2196) | func mul_1_int8_ssa(a int8) int8 {
function mul_int8_126_ssa (line 2201) | func mul_int8_126_ssa(a int8) int8 {
function mul_126_int8_ssa (line 2206) | func mul_126_int8_ssa(a int8) int8 {
function mul_int8_127_ssa (line 2211) | func mul_int8_127_ssa(a int8) int8 {
function mul_127_int8_ssa (line 2216) | func mul_127_int8_ssa(a int8) int8 {
function mod_int8_Neg128_ssa (line 2221) | func mod_int8_Neg128_ssa(a int8) int8 {
function mod_Neg128_int8_ssa (line 2226) | func mod_Neg128_int8_ssa(a int8) int8 {
function mod_int8_Neg127_ssa (line 2231) | func mod_int8_Neg127_ssa(a int8) int8 {
function mod_Neg127_int8_ssa (line 2236) | func mod_Neg127_int8_ssa(a int8) int8 {
function mod_int8_Neg1_ssa (line 2241) | func mod_int8_Neg1_ssa(a int8) int8 {
function mod_Neg1_int8_ssa (line 2246) | func mod_Neg1_int8_ssa(a int8) int8 {
function mod_0_int8_ssa (line 2251) | func mod_0_int8_ssa(a int8) int8 {
function mod_int8_1_ssa (line 2256) | func mod_int8_1_ssa(a int8) int8 {
function mod_1_int8_ssa (line 2261) | func mod_1_int8_ssa(a int8) int8 {
function mod_int8_126_ssa (line 2266) | func mod_int8_126_ssa(a int8) int8 {
function mod_126_int8_ssa (line 2271) | func mod_126_int8_ssa(a int8) int8 {
function mod_int8_127_ssa (line 2276) | func mod_int8_127_ssa(a int8) int8 {
function mod_127_int8_ssa (line 2281) | func mod_127_int8_ssa(a int8) int8 {
function main (line 2287) | func main() {
FILE: tests/data/pass/hello.go
function main (line 6) | func main() {
FILE: tests/data/pass/precedence.go
function main (line 3) | func main() {
FILE: tests/data/pass/rewriteAMD64.go
function rewriteValueAMD64 (line 9) | func rewriteValueAMD64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDB (line 800) | func rewriteValueAMD64_OpAMD64ADDB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDBconst (line 850) | func rewriteValueAMD64_OpAMD64ADDBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDL (line 899) | func rewriteValueAMD64_OpAMD64ADDL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDLconst (line 949) | func rewriteValueAMD64_OpAMD64ADDLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDQ (line 998) | func rewriteValueAMD64_OpAMD64ADDQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDQconst (line 1240) | func rewriteValueAMD64_OpAMD64ADDQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDW (line 1421) | func rewriteValueAMD64_OpAMD64ADDW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ADDWconst (line 1471) | func rewriteValueAMD64_OpAMD64ADDWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDB (line 1520) | func rewriteValueAMD64_OpAMD64ANDB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDBconst (line 1598) | func rewriteValueAMD64_OpAMD64ANDBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDL (line 1659) | func rewriteValueAMD64_OpAMD64ANDL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDLconst (line 1707) | func rewriteValueAMD64_OpAMD64ANDLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDQ (line 1768) | func rewriteValueAMD64_OpAMD64ANDQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDQconst (line 1822) | func rewriteValueAMD64_OpAMD64ANDQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDW (line 1917) | func rewriteValueAMD64_OpAMD64ANDW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ANDWconst (line 1995) | func rewriteValueAMD64_OpAMD64ANDWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd16 (line 2056) | func rewriteValueAMD64_OpAdd16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd32 (line 2072) | func rewriteValueAMD64_OpAdd32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd32F (line 2088) | func rewriteValueAMD64_OpAdd32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd64 (line 2104) | func rewriteValueAMD64_OpAdd64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd64F (line 2120) | func rewriteValueAMD64_OpAdd64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAdd8 (line 2136) | func rewriteValueAMD64_OpAdd8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAddPtr (line 2152) | func rewriteValueAMD64_OpAddPtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAddr (line 2168) | func rewriteValueAMD64_OpAddr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAnd16 (line 2184) | func rewriteValueAMD64_OpAnd16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAnd32 (line 2200) | func rewriteValueAMD64_OpAnd32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAnd64 (line 2216) | func rewriteValueAMD64_OpAnd64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAnd8 (line 2232) | func rewriteValueAMD64_OpAnd8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAvg64u (line 2248) | func rewriteValueAMD64_OpAvg64u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpBswap32 (line 2264) | func rewriteValueAMD64_OpBswap32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpBswap64 (line 2278) | func rewriteValueAMD64_OpBswap64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMOVLEQconst (line 2292) | func rewriteValueAMD64_OpAMD64CMOVLEQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMOVQEQconst (line 2383) | func rewriteValueAMD64_OpAMD64CMOVQEQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMOVWEQconst (line 2474) | func rewriteValueAMD64_OpAMD64CMOVWEQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPB (line 2565) | func rewriteValueAMD64_OpAMD64CMPB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPBconst (line 2602) | func rewriteValueAMD64_OpAMD64CMPBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPL (line 2752) | func rewriteValueAMD64_OpAMD64CMPL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPLconst (line 2789) | func rewriteValueAMD64_OpAMD64CMPLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPQ (line 2955) | func rewriteValueAMD64_OpAMD64CMPQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPQconst (line 2998) | func rewriteValueAMD64_OpAMD64CMPQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPW (line 3209) | func rewriteValueAMD64_OpAMD64CMPW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64CMPWconst (line 3246) | func rewriteValueAMD64_OpAMD64CMPWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpClosureCall (line 3396) | func rewriteValueAMD64_OpClosureCall(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCom16 (line 3416) | func rewriteValueAMD64_OpCom16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCom32 (line 3430) | func rewriteValueAMD64_OpCom32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCom64 (line 3444) | func rewriteValueAMD64_OpCom64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCom8 (line 3458) | func rewriteValueAMD64_OpCom8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst16 (line 3472) | func rewriteValueAMD64_OpConst16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst32 (line 3486) | func rewriteValueAMD64_OpConst32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst32F (line 3500) | func rewriteValueAMD64_OpConst32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst64 (line 3514) | func rewriteValueAMD64_OpConst64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst64F (line 3528) | func rewriteValueAMD64_OpConst64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConst8 (line 3542) | func rewriteValueAMD64_OpConst8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConstBool (line 3556) | func rewriteValueAMD64_OpConstBool(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConstNil (line 3570) | func rewriteValueAMD64_OpConstNil(v *Value, config *Config) bool {
function rewriteValueAMD64_OpConvert (line 3583) | func rewriteValueAMD64_OpConvert(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCtz16 (line 3601) | func rewriteValueAMD64_OpCtz16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCtz32 (line 3623) | func rewriteValueAMD64_OpCtz32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCtz64 (line 3645) | func rewriteValueAMD64_OpCtz64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt32Fto32 (line 3667) | func rewriteValueAMD64_OpCvt32Fto32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt32Fto64 (line 3681) | func rewriteValueAMD64_OpCvt32Fto64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt32Fto64F (line 3695) | func rewriteValueAMD64_OpCvt32Fto64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt32to32F (line 3709) | func rewriteValueAMD64_OpCvt32to32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt32to64F (line 3723) | func rewriteValueAMD64_OpCvt32to64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt64Fto32 (line 3737) | func rewriteValueAMD64_OpCvt64Fto32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt64Fto32F (line 3751) | func rewriteValueAMD64_OpCvt64Fto32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt64Fto64 (line 3765) | func rewriteValueAMD64_OpCvt64Fto64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt64to32F (line 3779) | func rewriteValueAMD64_OpCvt64to32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpCvt64to64F (line 3793) | func rewriteValueAMD64_OpCvt64to64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDeferCall (line 3807) | func rewriteValueAMD64_OpDeferCall(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv16 (line 3823) | func rewriteValueAMD64_OpDiv16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv16u (line 3839) | func rewriteValueAMD64_OpDiv16u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv32 (line 3855) | func rewriteValueAMD64_OpDiv32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv32F (line 3871) | func rewriteValueAMD64_OpDiv32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv32u (line 3887) | func rewriteValueAMD64_OpDiv32u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv64 (line 3903) | func rewriteValueAMD64_OpDiv64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv64F (line 3919) | func rewriteValueAMD64_OpDiv64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv64u (line 3935) | func rewriteValueAMD64_OpDiv64u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv8 (line 3951) | func rewriteValueAMD64_OpDiv8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpDiv8u (line 3971) | func rewriteValueAMD64_OpDiv8u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq16 (line 3991) | func rewriteValueAMD64_OpEq16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq32 (line 4009) | func rewriteValueAMD64_OpEq32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq32F (line 4027) | func rewriteValueAMD64_OpEq32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq64 (line 4045) | func rewriteValueAMD64_OpEq64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq64F (line 4063) | func rewriteValueAMD64_OpEq64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEq8 (line 4081) | func rewriteValueAMD64_OpEq8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpEqPtr (line 4099) | func rewriteValueAMD64_OpEqPtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq16 (line 4117) | func rewriteValueAMD64_OpGeq16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq16U (line 4135) | func rewriteValueAMD64_OpGeq16U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq32 (line 4153) | func rewriteValueAMD64_OpGeq32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq32F (line 4171) | func rewriteValueAMD64_OpGeq32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq32U (line 4189) | func rewriteValueAMD64_OpGeq32U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq64 (line 4207) | func rewriteValueAMD64_OpGeq64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq64F (line 4225) | func rewriteValueAMD64_OpGeq64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq64U (line 4243) | func rewriteValueAMD64_OpGeq64U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq8 (line 4261) | func rewriteValueAMD64_OpGeq8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGeq8U (line 4279) | func rewriteValueAMD64_OpGeq8U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGetClosurePtr (line 4297) | func rewriteValueAMD64_OpGetClosurePtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGetG (line 4309) | func rewriteValueAMD64_OpGetG(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGoCall (line 4323) | func rewriteValueAMD64_OpGoCall(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater16 (line 4339) | func rewriteValueAMD64_OpGreater16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater16U (line 4357) | func rewriteValueAMD64_OpGreater16U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater32 (line 4375) | func rewriteValueAMD64_OpGreater32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater32F (line 4393) | func rewriteValueAMD64_OpGreater32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater32U (line 4411) | func rewriteValueAMD64_OpGreater32U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater64 (line 4429) | func rewriteValueAMD64_OpGreater64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater64F (line 4447) | func rewriteValueAMD64_OpGreater64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater64U (line 4465) | func rewriteValueAMD64_OpGreater64U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater8 (line 4483) | func rewriteValueAMD64_OpGreater8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpGreater8U (line 4501) | func rewriteValueAMD64_OpGreater8U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul16 (line 4519) | func rewriteValueAMD64_OpHmul16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul16u (line 4535) | func rewriteValueAMD64_OpHmul16u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul32 (line 4551) | func rewriteValueAMD64_OpHmul32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul32u (line 4567) | func rewriteValueAMD64_OpHmul32u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul64 (line 4583) | func rewriteValueAMD64_OpHmul64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul64u (line 4599) | func rewriteValueAMD64_OpHmul64u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul8 (line 4615) | func rewriteValueAMD64_OpHmul8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpHmul8u (line 4631) | func rewriteValueAMD64_OpHmul8u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpITab (line 4647) | func rewriteValueAMD64_OpITab(v *Value, config *Config) bool {
function rewriteValueAMD64_OpInterCall (line 4667) | func rewriteValueAMD64_OpInterCall(v *Value, config *Config) bool {
function rewriteValueAMD64_OpIsInBounds (line 4685) | func rewriteValueAMD64_OpIsInBounds(v *Value, config *Config) bool {
function rewriteValueAMD64_OpIsNonNil (line 4703) | func rewriteValueAMD64_OpIsNonNil(v *Value, config *Config) bool {
function rewriteValueAMD64_OpIsSliceInBounds (line 4720) | func rewriteValueAMD64_OpIsSliceInBounds(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64LEAQ (line 4738) | func rewriteValueAMD64_OpAMD64LEAQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64LEAQ1 (line 4904) | func rewriteValueAMD64_OpAMD64LEAQ1(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64LEAQ2 (line 5135) | func rewriteValueAMD64_OpAMD64LEAQ2(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64LEAQ4 (line 5254) | func rewriteValueAMD64_OpAMD64LEAQ4(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64LEAQ8 (line 5351) | func rewriteValueAMD64_OpAMD64LEAQ8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq16 (line 5426) | func rewriteValueAMD64_OpLeq16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq16U (line 5444) | func rewriteValueAMD64_OpLeq16U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq32 (line 5462) | func rewriteValueAMD64_OpLeq32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq32F (line 5480) | func rewriteValueAMD64_OpLeq32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq32U (line 5498) | func rewriteValueAMD64_OpLeq32U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq64 (line 5516) | func rewriteValueAMD64_OpLeq64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq64F (line 5534) | func rewriteValueAMD64_OpLeq64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq64U (line 5552) | func rewriteValueAMD64_OpLeq64U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq8 (line 5570) | func rewriteValueAMD64_OpLeq8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLeq8U (line 5588) | func rewriteValueAMD64_OpLeq8U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess16 (line 5606) | func rewriteValueAMD64_OpLess16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess16U (line 5624) | func rewriteValueAMD64_OpLess16U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess32 (line 5642) | func rewriteValueAMD64_OpLess32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess32F (line 5660) | func rewriteValueAMD64_OpLess32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess32U (line 5678) | func rewriteValueAMD64_OpLess32U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess64 (line 5696) | func rewriteValueAMD64_OpLess64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess64F (line 5714) | func rewriteValueAMD64_OpLess64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess64U (line 5732) | func rewriteValueAMD64_OpLess64U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess8 (line 5750) | func rewriteValueAMD64_OpLess8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLess8U (line 5768) | func rewriteValueAMD64_OpLess8U(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLoad (line 5786) | func rewriteValueAMD64_OpLoad(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLrot16 (line 5881) | func rewriteValueAMD64_OpLrot16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLrot32 (line 5899) | func rewriteValueAMD64_OpLrot32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLrot64 (line 5917) | func rewriteValueAMD64_OpLrot64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLrot8 (line 5935) | func rewriteValueAMD64_OpLrot8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh16x16 (line 5953) | func rewriteValueAMD64_OpLsh16x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh16x32 (line 5978) | func rewriteValueAMD64_OpLsh16x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh16x64 (line 6003) | func rewriteValueAMD64_OpLsh16x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh16x8 (line 6028) | func rewriteValueAMD64_OpLsh16x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh32x16 (line 6053) | func rewriteValueAMD64_OpLsh32x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh32x32 (line 6078) | func rewriteValueAMD64_OpLsh32x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh32x64 (line 6103) | func rewriteValueAMD64_OpLsh32x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh32x8 (line 6128) | func rewriteValueAMD64_OpLsh32x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh64x16 (line 6153) | func rewriteValueAMD64_OpLsh64x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh64x32 (line 6178) | func rewriteValueAMD64_OpLsh64x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh64x64 (line 6203) | func rewriteValueAMD64_OpLsh64x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh64x8 (line 6228) | func rewriteValueAMD64_OpLsh64x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh8x16 (line 6253) | func rewriteValueAMD64_OpLsh8x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh8x32 (line 6278) | func rewriteValueAMD64_OpLsh8x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh8x64 (line 6303) | func rewriteValueAMD64_OpLsh8x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpLsh8x8 (line 6328) | func rewriteValueAMD64_OpLsh8x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBQSX (line 6353) | func rewriteValueAMD64_OpAMD64MOVBQSX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBQSXload (line 6401) | func rewriteValueAMD64_OpAMD64MOVBQSXload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBQZX (line 6430) | func rewriteValueAMD64_OpAMD64MOVBQZX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBload (line 6502) | func rewriteValueAMD64_OpAMD64MOVBload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBloadidx1 (line 6627) | func rewriteValueAMD64_OpAMD64MOVBloadidx1(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBstore (line 6676) | func rewriteValueAMD64_OpAMD64MOVBstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVBstoreconst (line 6851) | func rewriteValueAMD64_OpAMD64MOVBstoreconst(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVBstoreconstidx1 (line 6950) | func rewriteValueAMD64_OpAMD64MOVBstoreconstidx1(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVBstoreidx1 (line 6999) | func rewriteValueAMD64_OpAMD64MOVBstoreidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVLQSX (line 7052) | func rewriteValueAMD64_OpAMD64MOVLQSX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLQSXload (line 7100) | func rewriteValueAMD64_OpAMD64MOVLQSXload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLQZX (line 7129) | func rewriteValueAMD64_OpAMD64MOVLQZX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLload (line 7231) | func rewriteValueAMD64_OpAMD64MOVLload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLloadidx1 (line 7382) | func rewriteValueAMD64_OpAMD64MOVLloadidx1(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLloadidx4 (line 7455) | func rewriteValueAMD64_OpAMD64MOVLloadidx4(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLstore (line 7504) | func rewriteValueAMD64_OpAMD64MOVLstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVLstoreconst (line 7707) | func rewriteValueAMD64_OpAMD64MOVLstoreconst(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVLstoreconstidx1 (line 7832) | func rewriteValueAMD64_OpAMD64MOVLstoreconstidx1(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVLstoreconstidx4 (line 7905) | func rewriteValueAMD64_OpAMD64MOVLstoreconstidx4(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVLstoreidx1 (line 7954) | func rewriteValueAMD64_OpAMD64MOVLstoreidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVLstoreidx4 (line 8033) | func rewriteValueAMD64_OpAMD64MOVLstoreidx4(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVOload (line 8086) | func rewriteValueAMD64_OpAMD64MOVOload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVOstore (line 8138) | func rewriteValueAMD64_OpAMD64MOVOstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVQload (line 8194) | func rewriteValueAMD64_OpAMD64MOVQload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVQloadidx1 (line 8345) | func rewriteValueAMD64_OpAMD64MOVQloadidx1(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVQloadidx8 (line 8418) | func rewriteValueAMD64_OpAMD64MOVQloadidx8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVQstore (line 8467) | func rewriteValueAMD64_OpAMD64MOVQstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVQstoreconst (line 8628) | func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVQstoreconstidx1 (line 8753) | func rewriteValueAMD64_OpAMD64MOVQstoreconstidx1(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVQstoreconstidx8 (line 8826) | func rewriteValueAMD64_OpAMD64MOVQstoreconstidx8(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVQstoreidx1 (line 8875) | func rewriteValueAMD64_OpAMD64MOVQstoreidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVQstoreidx8 (line 8954) | func rewriteValueAMD64_OpAMD64MOVQstoreidx8(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVSDload (line 9007) | func rewriteValueAMD64_OpAMD64MOVSDload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVSDloadidx1 (line 9135) | func rewriteValueAMD64_OpAMD64MOVSDloadidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVSDloadidx8 (line 9184) | func rewriteValueAMD64_OpAMD64MOVSDloadidx8(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVSDstore (line 9233) | func rewriteValueAMD64_OpAMD64MOVSDstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVSDstoreidx1 (line 9371) | func rewriteValueAMD64_OpAMD64MOVSDstoreidx1(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVSDstoreidx8 (line 9424) | func rewriteValueAMD64_OpAMD64MOVSDstoreidx8(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVSSload (line 9477) | func rewriteValueAMD64_OpAMD64MOVSSload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVSSloadidx1 (line 9605) | func rewriteValueAMD64_OpAMD64MOVSSloadidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVSSloadidx4 (line 9654) | func rewriteValueAMD64_OpAMD64MOVSSloadidx4(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVSSstore (line 9703) | func rewriteValueAMD64_OpAMD64MOVSSstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVSSstoreidx1 (line 9841) | func rewriteValueAMD64_OpAMD64MOVSSstoreidx1(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVSSstoreidx4 (line 9894) | func rewriteValueAMD64_OpAMD64MOVSSstoreidx4(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVWQSX (line 9947) | func rewriteValueAMD64_OpAMD64MOVWQSX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWQSXload (line 9995) | func rewriteValueAMD64_OpAMD64MOVWQSXload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWQZX (line 10024) | func rewriteValueAMD64_OpAMD64MOVWQZX(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWload (line 10123) | func rewriteValueAMD64_OpAMD64MOVWload(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWloadidx1 (line 10274) | func rewriteValueAMD64_OpAMD64MOVWloadidx1(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWloadidx2 (line 10347) | func rewriteValueAMD64_OpAMD64MOVWloadidx2(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWstore (line 10396) | func rewriteValueAMD64_OpAMD64MOVWstore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MOVWstoreconst (line 10599) | func rewriteValueAMD64_OpAMD64MOVWstoreconst(v *Value, config *Config) b...
function rewriteValueAMD64_OpAMD64MOVWstoreconstidx1 (line 10724) | func rewriteValueAMD64_OpAMD64MOVWstoreconstidx1(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVWstoreconstidx2 (line 10797) | func rewriteValueAMD64_OpAMD64MOVWstoreconstidx2(v *Value, config *Confi...
function rewriteValueAMD64_OpAMD64MOVWstoreidx1 (line 10846) | func rewriteValueAMD64_OpAMD64MOVWstoreidx1(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MOVWstoreidx2 (line 10925) | func rewriteValueAMD64_OpAMD64MOVWstoreidx2(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64MULB (line 10978) | func rewriteValueAMD64_OpAMD64MULB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULBconst (line 11013) | func rewriteValueAMD64_OpAMD64MULBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULL (line 11032) | func rewriteValueAMD64_OpAMD64MULL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULLconst (line 11067) | func rewriteValueAMD64_OpAMD64MULLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULQ (line 11086) | func rewriteValueAMD64_OpAMD64MULQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULQconst (line 11127) | func rewriteValueAMD64_OpAMD64MULQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULW (line 11498) | func rewriteValueAMD64_OpAMD64MULW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64MULWconst (line 11533) | func rewriteValueAMD64_OpAMD64MULWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod16 (line 11552) | func rewriteValueAMD64_OpMod16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod16u (line 11568) | func rewriteValueAMD64_OpMod16u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod32 (line 11584) | func rewriteValueAMD64_OpMod32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod32u (line 11600) | func rewriteValueAMD64_OpMod32u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod64 (line 11616) | func rewriteValueAMD64_OpMod64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod64u (line 11632) | func rewriteValueAMD64_OpMod64u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod8 (line 11648) | func rewriteValueAMD64_OpMod8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMod8u (line 11668) | func rewriteValueAMD64_OpMod8u(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMove (line 11688) | func rewriteValueAMD64_OpMove(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul16 (line 12042) | func rewriteValueAMD64_OpMul16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul32 (line 12058) | func rewriteValueAMD64_OpMul32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul32F (line 12074) | func rewriteValueAMD64_OpMul32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul64 (line 12090) | func rewriteValueAMD64_OpMul64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul64F (line 12106) | func rewriteValueAMD64_OpMul64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpMul8 (line 12122) | func rewriteValueAMD64_OpMul8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NEGB (line 12138) | func rewriteValueAMD64_OpAMD64NEGB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NEGL (line 12156) | func rewriteValueAMD64_OpAMD64NEGL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NEGQ (line 12174) | func rewriteValueAMD64_OpAMD64NEGQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NEGW (line 12192) | func rewriteValueAMD64_OpAMD64NEGW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NOTB (line 12210) | func rewriteValueAMD64_OpAMD64NOTB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NOTL (line 12228) | func rewriteValueAMD64_OpAMD64NOTL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NOTQ (line 12246) | func rewriteValueAMD64_OpAMD64NOTQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64NOTW (line 12264) | func rewriteValueAMD64_OpAMD64NOTW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg16 (line 12282) | func rewriteValueAMD64_OpNeg16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg32 (line 12296) | func rewriteValueAMD64_OpNeg32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg32F (line 12310) | func rewriteValueAMD64_OpNeg32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg64 (line 12327) | func rewriteValueAMD64_OpNeg64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg64F (line 12341) | func rewriteValueAMD64_OpNeg64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeg8 (line 12358) | func rewriteValueAMD64_OpNeg8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq16 (line 12372) | func rewriteValueAMD64_OpNeq16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq32 (line 12390) | func rewriteValueAMD64_OpNeq32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq32F (line 12408) | func rewriteValueAMD64_OpNeq32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq64 (line 12426) | func rewriteValueAMD64_OpNeq64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq64F (line 12444) | func rewriteValueAMD64_OpNeq64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeq8 (line 12462) | func rewriteValueAMD64_OpNeq8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNeqPtr (line 12480) | func rewriteValueAMD64_OpNeqPtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNilCheck (line 12498) | func rewriteValueAMD64_OpNilCheck(v *Value, config *Config) bool {
function rewriteValueAMD64_OpNot (line 12514) | func rewriteValueAMD64_OpNot(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORB (line 12529) | func rewriteValueAMD64_OpAMD64ORB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORBconst (line 12577) | func rewriteValueAMD64_OpAMD64ORBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORL (line 12622) | func rewriteValueAMD64_OpAMD64ORL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORLconst (line 12885) | func rewriteValueAMD64_OpAMD64ORLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORQ (line 12930) | func rewriteValueAMD64_OpAMD64ORQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORQconst (line 13427) | func rewriteValueAMD64_OpAMD64ORQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORW (line 13470) | func rewriteValueAMD64_OpAMD64ORW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64ORWconst (line 13619) | func rewriteValueAMD64_OpAMD64ORWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpOffPtr (line 13664) | func rewriteValueAMD64_OpOffPtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpOr16 (line 13696) | func rewriteValueAMD64_OpOr16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpOr32 (line 13712) | func rewriteValueAMD64_OpOr32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpOr64 (line 13728) | func rewriteValueAMD64_OpOr64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpOr8 (line 13744) | func rewriteValueAMD64_OpOr8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16Ux16 (line 13760) | func rewriteValueAMD64_OpRsh16Ux16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16Ux32 (line 13785) | func rewriteValueAMD64_OpRsh16Ux32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16Ux64 (line 13810) | func rewriteValueAMD64_OpRsh16Ux64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16Ux8 (line 13835) | func rewriteValueAMD64_OpRsh16Ux8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16x16 (line 13860) | func rewriteValueAMD64_OpRsh16x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16x32 (line 13888) | func rewriteValueAMD64_OpRsh16x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16x64 (line 13916) | func rewriteValueAMD64_OpRsh16x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh16x8 (line 13944) | func rewriteValueAMD64_OpRsh16x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32Ux16 (line 13972) | func rewriteValueAMD64_OpRsh32Ux16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32Ux32 (line 13997) | func rewriteValueAMD64_OpRsh32Ux32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32Ux64 (line 14022) | func rewriteValueAMD64_OpRsh32Ux64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32Ux8 (line 14047) | func rewriteValueAMD64_OpRsh32Ux8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32x16 (line 14072) | func rewriteValueAMD64_OpRsh32x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32x32 (line 14100) | func rewriteValueAMD64_OpRsh32x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32x64 (line 14128) | func rewriteValueAMD64_OpRsh32x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh32x8 (line 14156) | func rewriteValueAMD64_OpRsh32x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64Ux16 (line 14184) | func rewriteValueAMD64_OpRsh64Ux16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64Ux32 (line 14209) | func rewriteValueAMD64_OpRsh64Ux32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64Ux64 (line 14234) | func rewriteValueAMD64_OpRsh64Ux64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64Ux8 (line 14259) | func rewriteValueAMD64_OpRsh64Ux8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64x16 (line 14284) | func rewriteValueAMD64_OpRsh64x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64x32 (line 14312) | func rewriteValueAMD64_OpRsh64x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64x64 (line 14340) | func rewriteValueAMD64_OpRsh64x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh64x8 (line 14368) | func rewriteValueAMD64_OpRsh64x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8Ux16 (line 14396) | func rewriteValueAMD64_OpRsh8Ux16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8Ux32 (line 14421) | func rewriteValueAMD64_OpRsh8Ux32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8Ux64 (line 14446) | func rewriteValueAMD64_OpRsh8Ux64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8Ux8 (line 14471) | func rewriteValueAMD64_OpRsh8Ux8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8x16 (line 14496) | func rewriteValueAMD64_OpRsh8x16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8x32 (line 14524) | func rewriteValueAMD64_OpRsh8x32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8x64 (line 14552) | func rewriteValueAMD64_OpRsh8x64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpRsh8x8 (line 14580) | func rewriteValueAMD64_OpRsh8x8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARB (line 14608) | func rewriteValueAMD64_OpAMD64SARB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARBconst (line 14691) | func rewriteValueAMD64_OpAMD64SARBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARL (line 14710) | func rewriteValueAMD64_OpAMD64SARL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARLconst (line 14793) | func rewriteValueAMD64_OpAMD64SARLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARQ (line 14812) | func rewriteValueAMD64_OpAMD64SARQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARQconst (line 14895) | func rewriteValueAMD64_OpAMD64SARQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARW (line 14914) | func rewriteValueAMD64_OpAMD64SARW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SARWconst (line 14997) | func rewriteValueAMD64_OpAMD64SARWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SBBLcarrymask (line 15016) | func rewriteValueAMD64_OpAMD64SBBLcarrymask(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64SBBQcarrymask (line 15081) | func rewriteValueAMD64_OpAMD64SBBQcarrymask(v *Value, config *Config) bo...
function rewriteValueAMD64_OpAMD64SETA (line 15146) | func rewriteValueAMD64_OpAMD64SETA(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETAE (line 15224) | func rewriteValueAMD64_OpAMD64SETAE(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETB (line 15302) | func rewriteValueAMD64_OpAMD64SETB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETBE (line 15380) | func rewriteValueAMD64_OpAMD64SETBE(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETEQ (line 15458) | func rewriteValueAMD64_OpAMD64SETEQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETG (line 15536) | func rewriteValueAMD64_OpAMD64SETG(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETGE (line 15614) | func rewriteValueAMD64_OpAMD64SETGE(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETL (line 15692) | func rewriteValueAMD64_OpAMD64SETL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETLE (line 15770) | func rewriteValueAMD64_OpAMD64SETLE(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SETNE (line 15848) | func rewriteValueAMD64_OpAMD64SETNE(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHLB (line 15926) | func rewriteValueAMD64_OpAMD64SHLB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHLL (line 16009) | func rewriteValueAMD64_OpAMD64SHLL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHLQ (line 16092) | func rewriteValueAMD64_OpAMD64SHLQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHLW (line 16175) | func rewriteValueAMD64_OpAMD64SHLW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHRB (line 16258) | func rewriteValueAMD64_OpAMD64SHRB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHRL (line 16341) | func rewriteValueAMD64_OpAMD64SHRL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHRQ (line 16424) | func rewriteValueAMD64_OpAMD64SHRQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SHRW (line 16507) | func rewriteValueAMD64_OpAMD64SHRW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBB (line 16590) | func rewriteValueAMD64_OpAMD64SUBB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBBconst (line 16639) | func rewriteValueAMD64_OpAMD64SUBBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBL (line 16699) | func rewriteValueAMD64_OpAMD64SUBL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBLconst (line 16748) | func rewriteValueAMD64_OpAMD64SUBLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBQ (line 16808) | func rewriteValueAMD64_OpAMD64SUBQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBQconst (line 16863) | func rewriteValueAMD64_OpAMD64SUBQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBW (line 16928) | func rewriteValueAMD64_OpAMD64SUBW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64SUBWconst (line 16977) | func rewriteValueAMD64_OpAMD64SUBWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt16to32 (line 17037) | func rewriteValueAMD64_OpSignExt16to32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt16to64 (line 17051) | func rewriteValueAMD64_OpSignExt16to64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt32to64 (line 17065) | func rewriteValueAMD64_OpSignExt32to64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt8to16 (line 17079) | func rewriteValueAMD64_OpSignExt8to16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt8to32 (line 17093) | func rewriteValueAMD64_OpSignExt8to32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSignExt8to64 (line 17107) | func rewriteValueAMD64_OpSignExt8to64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSqrt (line 17121) | func rewriteValueAMD64_OpSqrt(v *Value, config *Config) bool {
function rewriteValueAMD64_OpStaticCall (line 17135) | func rewriteValueAMD64_OpStaticCall(v *Value, config *Config) bool {
function rewriteValueAMD64_OpStore (line 17153) | func rewriteValueAMD64_OpStore(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub16 (line 17260) | func rewriteValueAMD64_OpSub16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub32 (line 17276) | func rewriteValueAMD64_OpSub32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub32F (line 17292) | func rewriteValueAMD64_OpSub32F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub64 (line 17308) | func rewriteValueAMD64_OpSub64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub64F (line 17324) | func rewriteValueAMD64_OpSub64F(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSub8 (line 17340) | func rewriteValueAMD64_OpSub8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpSubPtr (line 17356) | func rewriteValueAMD64_OpSubPtr(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc16to8 (line 17372) | func rewriteValueAMD64_OpTrunc16to8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc32to16 (line 17387) | func rewriteValueAMD64_OpTrunc32to16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc32to8 (line 17402) | func rewriteValueAMD64_OpTrunc32to8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc64to16 (line 17417) | func rewriteValueAMD64_OpTrunc64to16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc64to32 (line 17432) | func rewriteValueAMD64_OpTrunc64to32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpTrunc64to8 (line 17447) | func rewriteValueAMD64_OpTrunc64to8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORB (line 17462) | func rewriteValueAMD64_OpAMD64XORB(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORBconst (line 17509) | func rewriteValueAMD64_OpAMD64XORBconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORL (line 17542) | func rewriteValueAMD64_OpAMD64XORL(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORLconst (line 17589) | func rewriteValueAMD64_OpAMD64XORLconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORQ (line 17622) | func rewriteValueAMD64_OpAMD64XORQ(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORQconst (line 17675) | func rewriteValueAMD64_OpAMD64XORQconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORW (line 17707) | func rewriteValueAMD64_OpAMD64XORW(v *Value, config *Config) bool {
function rewriteValueAMD64_OpAMD64XORWconst (line 17754) | func rewriteValueAMD64_OpAMD64XORWconst(v *Value, config *Config) bool {
function rewriteValueAMD64_OpXor16 (line 17787) | func rewriteValueAMD64_OpXor16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpXor32 (line 17803) | func rewriteValueAMD64_OpXor32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpXor64 (line 17819) | func rewriteValueAMD64_OpXor64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpXor8 (line 17835) | func rewriteValueAMD64_OpXor8(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZero (line 17851) | func rewriteValueAMD64_OpZero(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt16to32 (line 18165) | func rewriteValueAMD64_OpZeroExt16to32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt16to64 (line 18179) | func rewriteValueAMD64_OpZeroExt16to64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt32to64 (line 18193) | func rewriteValueAMD64_OpZeroExt32to64(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt8to16 (line 18207) | func rewriteValueAMD64_OpZeroExt8to16(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt8to32 (line 18221) | func rewriteValueAMD64_OpZeroExt8to32(v *Value, config *Config) bool {
function rewriteValueAMD64_OpZeroExt8to64 (line 18235) | func rewriteValueAMD64_OpZeroExt8to64(v *Value, config *Config) bool {
function rewriteBlockAMD64 (line 18249) | func rewriteBlockAMD64(b *Block) bool {
FILE: tests/data/pass/simplest.go
function main (line 3) | func main() {}
FILE: tests/data/pass/viper.go
function init (line 44) | func init() {
type remoteConfigFactory (line 48) | type remoteConfigFactory interface
type UnsupportedConfigError (line 58) | type UnsupportedConfigError
method Error (line 61) | func (str UnsupportedConfigError) Error() string {
type UnsupportedRemoteProviderError (line 68) | type UnsupportedRemoteProviderError
method Error (line 71) | func (str UnsupportedRemoteProviderError) Error() string {
type RemoteConfigError (line 77) | type RemoteConfigError
method Error (line 80) | func (rce RemoteConfigError) Error() string {
type ConfigFileNotFoundError (line 85) | type ConfigFileNotFoundError struct
method Error (line 90) | func (fnfe ConfigFileNotFoundError) Error() string {
type Viper (line 128) | type Viper struct
method OnConfigChange (line 227) | func (v *Viper) OnConfigChange(run func(in fsnotify.Event)) {
method WatchConfig (line 232) | func (v *Viper) WatchConfig() {
method SetConfigFile (line 273) | func (v *Viper) SetConfigFile(in string) {
method SetEnvPrefix (line 283) | func (v *Viper) SetEnvPrefix(in string) {
method mergeWithEnvPrefix (line 289) | func (v *Viper) mergeWithEnvPrefix(in string) string {
method getEnv (line 304) | func (v *Viper) getEnv(key string) string {
method ConfigFileUsed (line 313) | func (v *Viper) ConfigFileUsed() string { return v.configFile }
method AddConfigPath (line 318) | func (v *Viper) AddConfigPath(in string) {
method AddRemoteProvider (line 339) | func (v *Viper) AddRemoteProvider(provider, endpoint, path string) err...
method AddSecureRemoteProvider (line 371) | func (v *Viper) AddSecureRemoteProvider(provider, endpoint, path, secr...
method providerPathExists (line 390) | func (v *Viper) providerPathExists(p *defaultRemoteProvider) bool {
method searchMap (line 399) | func (v *Viper) searchMap(source map[string]interface{}, path []string...
method SetTypeByDefaultValue (line 446) | func (v *Viper) SetTypeByDefaultValue(enable bool) {
method Get (line 458) | func (v *Viper) Get(key string) interface{} {
method Sub (line 526) | func (v *Viper) Sub(key string) *Viper {
method GetString (line 539) | func (v *Viper) GetString(key string) string {
method GetBool (line 545) | func (v *Viper) GetBool(key string) bool {
method GetInt (line 551) | func (v *Viper) GetInt(key string) int {
method GetFloat64 (line 557) | func (v *Viper) GetFloat64(key string) float64 {
method GetTime (line 563) | func (v *Viper) GetTime(key string) time.Time {
method GetDuration (line 569) | func (v *Viper) GetDuration(key string) time.Duration {
method GetStringSlice (line 575) | func (v *Viper) GetStringSlice(key string) []string {
method GetStringMap (line 581) | func (v *Viper) GetStringMap(key string) map[string]interface{} {
method GetStringMapString (line 587) | func (v *Viper) GetStringMapString(key string) map[string]string {
method GetStringMapStringSlice (line 593) | func (v *Viper) GetStringMapStringSlice(key string) map[string][]string {
method GetSizeInBytes (line 600) | func (v *Viper) GetSizeInBytes(key string) uint {
method UnmarshalKey (line 607) | func (v *Viper) UnmarshalKey(key string, rawVal interface{}) error {
method Unmarshal (line 614) | func (v *Viper) Unmarshal(rawVal interface{}) error {
method UnmarshalExact (line 645) | func (v *Viper) UnmarshalExact(rawVal interface{}) error {
method BindPFlags (line 660) | func (v *Viper) BindPFlags(flags *pflag.FlagSet) (err error) {
method BindPFlag (line 671) | func (v *Viper) BindPFlag(key string, flag *pflag.Flag) (err error) {
method BindFlagValues (line 678) | func (v *Viper) BindFlagValues(flags FlagValueSet) (err error) {
method BindFlagValue (line 694) | func (v *Viper) BindFlagValue(key string, flag FlagValue) (err error) {
method BindEnv (line 707) | func (v *Viper) BindEnv(input ...string) (err error) {
method find (line 730) | func (v *Viper) find(key string) interface{} {
method IsSet (line 814) | func (v *Viper) IsSet(key string) bool {
method AutomaticEnv (line 835) | func (v *Viper) AutomaticEnv() {
method SetEnvKeyReplacer (line 843) | func (v *Viper) SetEnvKeyReplacer(r *strings.Replacer) {
method RegisterAlias (line 850) | func (v *Viper) RegisterAlias(alias string, key string) {
method registerAlias (line 854) | func (v *Viper) registerAlias(alias string, key string) {
method realKey (line 886) | func (v *Viper) realKey(key string) string {
method InConfig (line 898) | func (v *Viper) InConfig(key string) bool {
method SetDefault (line 909) | func (v *Viper) SetDefault(key string, value interface{}) {
method Set (line 919) | func (v *Viper) Set(key string, value interface{}) {
method ReadInConfig (line 928) | func (v *Viper) ReadInConfig() error {
method MergeInConfig (line 946) | func (v *Viper) MergeInConfig() error {
method ReadConfig (line 963) | func (v *Viper) ReadConfig(in io.Reader) error {
method MergeConfig (line 970) | func (v *Viper) MergeConfig(in io.Reader) error {
method ReadRemoteConfig (line 1071) | func (v *Viper) ReadRemoteConfig() error {
method WatchRemoteConfig (line 1080) | func (v *Viper) WatchRemoteConfig() error {
method unmarshalReader (line 1094) | func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}...
method insensitiviseMaps (line 1098) | func (v *Viper) insensitiviseMaps() {
method getKeyValueConfig (line 1106) | func (v *Viper) getKeyValueConfig() error {
method getRemoteConfig (line 1122) | func (v *Viper) getRemoteConfig(provider *defaultRemoteProvider) (map[...
method watchKeyValueConfig (line 1133) | func (v *Viper) watchKeyValueConfig() error {
method watchRemoteConfig (line 1145) | func (v *Viper) watchRemoteConfig(provider *defaultRemoteProvider) (ma...
method AllKeys (line 1156) | func (v *Viper) AllKeys() []string {
method AllSettings (line 1197) | func (v *Viper) AllSettings() map[string]interface{} {
method SetConfigName (line 1209) | func (v *Viper) SetConfigName(in string) {
method SetConfigType (line 1218) | func (v *Viper) SetConfigType(in string) {
method getConfigType (line 1224) | func (v *Viper) getConfigType() string {
method getConfigFile (line 1239) | func (v *Viper) getConfigFile() string {
method searchInPath (line 1254) | func (v *Viper) searchInPath(in string) (filename string) {
method findConfigFile (line 1269) | func (v *Viper) findConfigFile() (string, error) {
method Debug (line 1285) | func (v *Viper) Debug() {
function New (line 161) | func New() *Viper {
function Reset (line 180) | func Reset() {
type defaultRemoteProvider (line 186) | type defaultRemoteProvider struct
method Provider (line 193) | func (rp defaultRemoteProvider) Provider() string {
method Endpoint (line 197) | func (rp defaultRemoteProvider) Endpoint() string {
method Path (line 201) | func (rp defaultRemoteProvider) Path() string {
method SecretKeyring (line 205) | func (rp defaultRemoteProvider) SecretKeyring() string {
type RemoteProvider (line 213) | type RemoteProvider interface
function OnConfigChange (line 226) | func OnConfigChange(run func(in fsnotify.Event)) { v.OnConfigChange(run) }
function WatchConfig (line 231) | func WatchConfig() { v.WatchConfig() }
function SetConfigFile (line 272) | func SetConfigFile(in string) { v.SetConfigFile(in) }
function SetEnvPrefix (line 282) | func SetEnvPrefix(in string) { v.SetEnvPrefix(in) }
function ConfigFileUsed (line 312) | func ConfigFileUsed() string { return v.ConfigFileUsed() }
function AddConfigPath (line 317) | func AddConfigPath(in string) { v.AddConfigPath(in) }
function AddRemoteProvider (line 336) | func AddRemoteProvider(provider, endpoint, path string) error {
function AddSecureRemoteProvider (line 367) | func AddSecureRemoteProvider(provider, endpoint, path, secretkeyring str...
function SetTypeByDefaultValue (line 445) | func SetTypeByDefaultValue(enable bool) { v.SetTypeByDefaultValue(enable) }
function Get (line 457) | func Get(key string) interface{} { return v.Get(key) }
function Sub (line 525) | func Sub(key string) *Viper { return v.Sub(key) }
function GetString (line 538) | func GetString(key string) string { return v.GetString(key) }
function GetBool (line 544) | func GetBool(key string) bool { return v.GetBool(key) }
function GetInt (line 550) | func GetInt(key string) int { return v.GetInt(key) }
function GetFloat64 (line 556) | func GetFloat64(key string) float64 { return v.GetFloat64(key) }
function GetTime (line 562) | func GetTime(key string) time.Time { return v.GetTime(key) }
function GetDuration (line 568) | func GetDuration(key string) time.Duration { return v.GetDuration(key) }
function GetStringSlice (line 574) | func GetStringSlice(key string) []string { return v.GetStringSlice(key) }
function GetStringMap (line 580) | func GetStringMap(key string) map[string]interface{} { return v.GetStrin...
function GetStringMapString (line 586) | func GetStringMapString(key string) map[string]string { return v.GetStri...
function GetStringMapStringSlice (line 592) | func GetStringMapStringSlice(key string) map[string][]string { return v....
function GetSizeInBytes (line 599) | func GetSizeInBytes(key string) uint { return v.GetSizeInBytes(key) }
function UnmarshalKey (line 606) | func UnmarshalKey(key string, rawVal interface{}) error { return v.Unmar...
function Unmarshal (line 613) | func Unmarshal(rawVal interface{}) error { return v.Unmarshal(rawVal) }
function weakDecodeExact (line 628) | func weakDecodeExact(input, output interface{}) error {
function BindPFlags (line 659) | func BindPFlags(flags *pflag.FlagSet) (err error) { return v.BindPFlags(...
function BindPFlag (line 670) | func BindPFlag(key string, flag *pflag.Flag) (err error) { return v.Bind...
function BindFlagValues (line 677) | func BindFlagValues(flags FlagValueSet) (err error) { return v.BindFlagV...
function BindFlagValue (line 693) | func BindFlagValue(key string, flag FlagValue) (err error) { return v.Bi...
function BindEnv (line 706) | func BindEnv(input ...string) (err error) { return v.BindEnv(input...) }
function IsSet (line 813) | func IsSet(key string) bool { return v.IsSet(key) }
function AutomaticEnv (line 834) | func AutomaticEnv() { v.AutomaticEnv() }
function SetEnvKeyReplacer (line 842) | func SetEnvKeyReplacer(r *strings.Replacer) { v.SetEnvKeyReplacer(r) }
function RegisterAlias (line 849) | func RegisterAlias(alias string, key string) { v.RegisterAlias(alias, ke...
function InConfig (line 897) | func InConfig(key string) bool { return v.InConfig(key) }
function SetDefault (line 908) | func SetDefault(key string, value interface{}) { v.SetDefault(key, value) }
function Set (line 918) | func Set(key string, value interface{}) { v.Set(key, value) }
function ReadInConfig (line 927) | func ReadInConfig() error { return v.ReadInConfig() }
function MergeInConfig (line 945) | func MergeInConfig() error { return v.MergeInConfig() }
function ReadConfig (line 962) | func ReadConfig(in io.Reader) error { return v.ReadConfig(in) }
function MergeConfig (line 969) | func MergeConfig(in io.Reader) error { return v.MergeConfig(in) }
function keyExists (line 982) | func keyExists(k string, m map[string]interface{}) string {
function castToMapStringInterface (line 993) | func castToMapStringInterface(
function mergeMaps (line 1007) | func mergeMaps(
function ReadRemoteConfig (line 1070) | func ReadRemoteConfig() error { return v.ReadRemoteConfig() }
function WatchRemoteConfig (line 1079) | func WatchRemoteConfig() error { return v.WatchRemoteConfig() }
function unmarshalReader (line 1090) | func unmarshalReader(in io.Reader, c map[string]interface{}) error {
function AllKeys (line 1155) | func AllKeys() []string { return v.AllKeys() }
function AllSettings (line 1196) | func AllSettings() map[string]interface{} { return v.AllSettings() }
function SetConfigName (line 1208) | func SetConfigName(in string) { v.SetConfigName(in) }
function SetConfigType (line 1217) | func SetConfigType(in string) { v.SetConfigType(in) }
function Debug (line 1284) | func Debug() { v.Debug() }
FILE: tests/runner.rs
function flush (line 14) | fn flush() {
function test_path (line 20) | fn test_path<P: AsRef<Path>>(path: P) -> PathBuf {
function for_all_in (line 28) | fn for_all_in<P: AsRef<Path>, F: Fn(String) -> U, U>(path: P, f: F) {
function main (line 38) | fn main() {
function lexing_does_not_panic (line 47) | fn lexing_does_not_panic() {
function parsing_does_not_panic (line 57) | fn parsing_does_not_panic() {
Condensed preview — 28 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,117K chars).
[
{
"path": ".gitignore",
"chars": 28,
"preview": "target\ncallgrind.out.*\n/tmp\n"
},
{
"path": ".travis.yml",
"chars": 84,
"preview": "language: rust\nrust:\n - nightly\n - beta\n - stable\n\nnotifications:\n email: false\n"
},
{
"path": "CONTRIBUTING.md",
"chars": 1714,
"preview": "# Contributing\n\nYou can find sections of the code in need of attention by exploring GitHub\nissues, and/or with the help "
},
{
"path": "Cargo.toml",
"chars": 693,
"preview": "[package]\nauthors = [\"Yohai Berreby (yberreby) <yohaiberreby@gmail.com>\"]\ndescription = \"A work-in-progress Go compiler "
},
{
"path": "README.md",
"chars": 1184,
"preview": "# rgo (stalled) [](https://travis-ci.org/yberreby/r"
},
{
"path": "benches/parse.rs",
"chars": 1163,
"preview": "#![feature(test)]\n\n\n/// Utility macro to bench test files one by one.\nmacro_rules! bench_lex {\n ($name:ident, $path:e"
},
{
"path": "misc/log.md",
"chars": 5276,
"preview": "# Log\n\nThis is the log file for the `rgo` project. I (@yberreby) write my thoughts down\nperiodically. I hope this will h"
},
{
"path": "misc/selector-inconsistency.md",
"chars": 1878,
"preview": "https://play.golang.org/p/Xne3T3CL7d\n\n```go\npackage main\n\nimport (\n\t\"go/ast\"\n\t\"go/parser\"\n\t\"go/token\"\n)\n\nfunc main() {\n\t"
},
{
"path": "src/ast/expressions.rs",
"chars": 8745,
"preview": "use lexer::TokenKind;\nuse token::Spanned;\nuse super::{Arguments, Conversion, Type, Ident, MaybeQualifiedIdent, Literal};"
},
{
"path": "src/ast/mod.rs",
"chars": 10875,
"preview": "//! The Abstract Syntax Tree.\n//!\n//! If you want to learn more, it is recommended to read the [Go language\n//! specific"
},
{
"path": "src/ast/statements.rs",
"chars": 6488,
"preview": "use super::{Block, Expr, ShortVarDecl, ConstDecl, TypeDecl, VarDecl, BinaryOperator};\nuse token::Spanned;\n\n\n// Statement"
},
{
"path": "src/ast/types.rs",
"chars": 3946,
"preview": "use super::*;\n\n/// An array type.\n///\n/// ## Grammar\n///\n/// ```ignore\n/// ArrayType = \"[\" ArrayLength \"]\" ElementType"
},
{
"path": "src/lexer/mod.rs",
"chars": 21027,
"preview": "//! # Lexer\n//!\n//! A `Lexer` parses a source string into a list of tokens, which may later be used to construct an\n//! "
},
{
"path": "src/lexer/test.rs",
"chars": 10358,
"preview": "use super::{Token, TokenKind, tokenize};\nuse token::TokenKind::*;\n\n// XXX: use the full TokenKind::* path, or `use Token"
},
{
"path": "src/lib.rs",
"chars": 509,
"preview": "#![cfg_attr(feature=\"clippy\", feature(plugin))]\n#![cfg_attr(feature=\"clippy\", plugin(clippy))]\n\n#[macro_use]\nextern crat"
},
{
"path": "src/main.rs",
"chars": 707,
"preview": "extern crate convenience;\nextern crate rgo;\n#[macro_use]\nextern crate log;\nextern crate env_logger;\nextern crate time;\nu"
},
{
"path": "src/parser/error.rs",
"chars": 1704,
"preview": "use std::fmt;\nuse token::{Span, Token, TokenKind};\n\npub type PResult<T> = ::std::result::Result<T, Error>;\n\n#[derive(Deb"
},
{
"path": "src/parser/mod.rs",
"chars": 53333,
"preview": "use std::iter::Peekable;\nuse num::bigint::BigInt;\nuse num::BigRational;\nuse token::*;\nuse ast;\n\n#[cfg(test)]\nmod test;\n\n"
},
{
"path": "src/parser/test.rs",
"chars": 6888,
"preview": "use super::*;\nuse std::str::FromStr;\nuse lexer;\nuse ast;\nuse num::bigint::BigInt;\nuse num::BigRational;\n\n// String liter"
},
{
"path": "src/pos.rs",
"chars": 285,
"preview": "#[derive(Debug, Clone, PartialEq, Eq)]\npub struct Position {\n /// 1-indexed row.\n pub row: usize,\n /// 1-indexe"
},
{
"path": "src/token.rs",
"chars": 13467,
"preview": "use std::fmt;\nuse self::TokenKind::*;\n\n#[derive(Debug, Clone, PartialEq, Eq)]\npub struct TokenAndSpan {\n pub token: T"
},
{
"path": "tests/data/pass/arithConst_ssa.go",
"chars": 424807,
"preview": "package main\n\nimport \"fmt\"\n\n//go:noinline\nfunc add_uint64_0_ssa(a uint64) uint64 {\n\treturn a + 0\n}\n\n//go:noinline\nfunc a"
},
{
"path": "tests/data/pass/hello.go",
"chars": 132,
"preview": "// GOAL: parse, compile, run, assert output == \"Hello, rgo\".\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"Hel"
},
{
"path": "tests/data/pass/precedence.go",
"chars": 175,
"preview": "package main\n\nfunc main() {\n\t// Equals 97.\n\ta := 45 + 52\n\t// Next line equivalent to: (23%45) + (21/45) + 5 - ((2<<3)*6)"
},
{
"path": "tests/data/pass/rewriteAMD64.go",
"chars": 399282,
"preview": "// autogenerated from gen/AMD64.rules: do not edit!\n// generated with: cd gen; go run *.go\n\npackage ssa\n\nimport \"math\"\n\n"
},
{
"path": "tests/data/pass/simplest.go",
"chars": 29,
"preview": "package main\n\nfunc main() {}\n"
},
{
"path": "tests/data/pass/viper.go",
"chars": 36246,
"preview": "// Copyright © 2014 Steve Francia <spf@spf13.com>.\n//\n// Use of this source code is governed by an MIT-style\n// license "
},
{
"path": "tests/runner.rs",
"chars": 1701,
"preview": "#[macro_use]\nextern crate log;\nextern crate rgo;\nextern crate convenience as cnv;\nextern crate env_logger;\nextern crate "
}
]
About this extraction
This page contains the full source code of the yberreby/rgo GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 28 files (989.0 KB), approximately 380.0k tokens, and a symbol index with 1267 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.