summaryrefslogtreecommitdiffstats
path: root/llvm/docs/tutorial/LangImpl1.rst
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-08-19 18:15:58 +0000
committerLang Hames <lhames@gmail.com>2015-08-19 18:15:58 +0000
commit59b0da886efd85ed8b93c74d3e32da7e7252e4a0 (patch)
tree0f55d1804f4c34aa4bdfa43ce9a8fb80fd2b4ab9 /llvm/docs/tutorial/LangImpl1.rst
parentbe6e0539381fa5aab0de22bd598688973b72ab85 (diff)
downloadbcm5719-llvm-59b0da886efd85ed8b93c74d3e32da7e7252e4a0.tar.gz
bcm5719-llvm-59b0da886efd85ed8b93c74d3e32da7e7252e4a0.zip
[Kaleidoscope] Clang-format the Kaleidoscope tutorials.
Also reduces changes between tutorial chapters. llvm-svn: 245472
Diffstat (limited to 'llvm/docs/tutorial/LangImpl1.rst')
-rw-r--r--llvm/docs/tutorial/LangImpl1.rst19
1 files changed, 12 insertions, 7 deletions
diff --git a/llvm/docs/tutorial/LangImpl1.rst b/llvm/docs/tutorial/LangImpl1.rst
index 6840bd6b090..0240986164f 100644
--- a/llvm/docs/tutorial/LangImpl1.rst
+++ b/llvm/docs/tutorial/LangImpl1.rst
@@ -169,14 +169,16 @@ numeric value of a number). First, we define the possibilities:
tok_eof = -1,
// commands
- tok_def = -2, tok_extern = -3,
+ tok_def = -2,
+ tok_extern = -3,
// primary
- tok_identifier = -4, tok_number = -5,
+ tok_identifier = -4,
+ tok_number = -5,
};
- static std::string IdentifierStr; // Filled in if tok_identifier
- static double NumVal; // Filled in if tok_number
+ static std::string IdentifierStr; // Filled in if tok_identifier
+ static double NumVal; // Filled in if tok_number
Each token returned by our lexer will either be one of the Token enum
values or it will be an 'unknown' character like '+', which is returned
@@ -217,8 +219,10 @@ loop:
while (isalnum((LastChar = getchar())))
IdentifierStr += LastChar;
- if (IdentifierStr == "def") return tok_def;
- if (IdentifierStr == "extern") return tok_extern;
+ if (IdentifierStr == "def")
+ return tok_def;
+ if (IdentifierStr == "extern")
+ return tok_extern;
return tok_identifier;
}
@@ -250,7 +254,8 @@ extend it :). Next we handle comments:
if (LastChar == '#') {
// Comment until end of line.
- do LastChar = getchar();
+ do
+ LastChar = getchar();
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
if (LastChar != EOF)
OpenPOWER on IntegriCloud