Created
April 4, 2016 07:16
-
-
Save inkrement/ef0f6a1dbc174c143c5b433b9294ac43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[a4paper]{article} | |
\usepackage[english]{babel} | |
\usepackage{listings} | |
%% for swift | |
\lstdefinelanguage{Swift}{ | |
keywords={associatedtype, class, deinit, enum, extension, func, import, init, inout, internal, let, operator, private, protocol, public, static, struct, subscript, typealias, var, break, case, continue, default, defer, do, else, fallthrough, for, guard, if, in, repeat, return, switch, where, while, as, catch, dynamicType, false, is, nil, rethrows, super, self, Self, throw, throws, true, try, associativity, convenience, dynamic, didSet, final, get, infix, indirect, lazy, left, mutating, none, nonmutating, optional, override, postfix, precedence, prefix, Protocol, required, right, set, Type, unowned, weak, willSet}, | |
ndkeywords={class, export, boolean, throw, implements, import, this}, | |
sensitive=false, | |
comment=[l]{//}, | |
morecomment=[s]{/*}{*/}, | |
morestring=[b]', | |
morestring=[b]" | |
} | |
\lstdefinelanguage{Gherkin}{ | |
keywords={When, Then, Given, And}, | |
ndkeywords={Feature, Scenario}, | |
sensitive=false, | |
comment=[l]{\#}, | |
morestring=[b]', | |
morestring=[b]" | |
} | |
\title{Gherkin and Swift syntax highlighting demonstation} | |
\author{Christian Hotz-Behofsits} | |
\begin{document} | |
\maketitle | |
\begin{abstract} | |
Nice syntax highlighting demonstration for gherkin and swift. | |
\end{abstract} | |
\section{Examples} | |
\subsection{Swift} | |
\begin{lstlisting}[language=Swift] | |
var implicitInteger = 70 | |
var implicitDouble = 70.0 | |
var explicitDouble: Double = 70 | |
let apples = 3 | |
let oranges = 5 | |
let appleSummary = "Ich habe \(apples) Äpfel." | |
let fruitSummary = "Ich habe \(apples + oranges) Früchte." | |
print("Hallo Welt!") | |
let people = ["Anna": 67, "Julia": 8, "Hans": 33, "Peter": 25] | |
for (name, age) in people { | |
print("\(name) ist \(age) Jahre alt.") | |
} | |
\end{lstlisting} | |
\subsection{Gherkin} | |
\begin{lstlisting}[language=Gherkin] | |
Feature: feature description | |
Scenario: Some determinable business situation | |
Given some precondition | |
And some other precondition | |
When some action by the actor | |
And some other action | |
And yet another action | |
Then some testable outcome is achieved | |
And something else we can check happens too | |
\end{lstlisting} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment