From 95f1a04677dc854b78fe15fb9e4381eeb1100fae Mon Sep 17 00:00:00 2001
From: LucF <50338286+LucFF@users.noreply.github.com>
Date: Sat, 31 Aug 2019 09:13:44 -0400
Subject: [PATCH 1/5] Add files via upload
---
pine_lexer.py | 25 +++++++++++++++++++++++++
pine_style.py | 28 ++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
create mode 100644 pine_lexer.py
create mode 100644 pine_style.py
diff --git a/pine_lexer.py b/pine_lexer.py
new file mode 100644
index 0000000..77b57ad
--- /dev/null
+++ b/pine_lexer.py
@@ -0,0 +1,25 @@
+from pygments.lexer import RegexLexer
+from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
+ Number, Literal, Punctuation, Generic, Other, Error
+
+# Many examples are here https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/lexers/
+class PinePygmentsLexer(RegexLexer):
+ name = 'pine'
+
+ tokens = {
+ 'root': [
+ (r'\#([0-9a-fA-F]{8})|\#([0-9a-fA-F]{6})', Literal), # Color literal
+ (r'[0-9]+', Number.Integer),
+ (r'(\.\d+|[0-9]+\.[0-9]*)([eE][-+]?[0-9]+)?', Number.Float),
+ (r'\s+', Text.Whitespace),
+ (r'//.*?$', Comment),
+ (r'(for|if|else|var)\b', Keyword),
+ (r'(open|high|low|close|volume|time|hl2|hlc3|ohlc4)\b', Name.Constant), # Built-in series 'open', 'high', ...
+ (r'(study|strategy|plot|plotshape|plotchar|plotarrow|fill|hline|input)\b', Name.Entity), # Annotation function
+ (r'[\w\.]+', Name.Other),
+ (r'\+|\-|\*|\/|\%|\=|\[|\]|and|or|not|\?|\:|\<|\>|\!', Operator),
+ (r'\(|\)|\,', Punctuation),
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
+ (r"'(\\\\|\\'|[^'])*'", String.Single),
+ ]
+ }
\ No newline at end of file
diff --git a/pine_style.py b/pine_style.py
new file mode 100644
index 0000000..1ed5fbe
--- /dev/null
+++ b/pine_style.py
@@ -0,0 +1,28 @@
+from pygments.style import Style
+from pygments.token import Keyword, Name, Comment, String, Error, \
+ Number, Literal, Operator, Generic, Whitespace
+
+# Many examples are here https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/styles/default.py
+
+class PineStyle(Style):
+ background_color = "#f8f8f8"
+ default_style = ""
+
+ styles = {
+ Whitespace: "#bbbbbb",
+ Comment: "italic #408080",
+
+ Keyword: "bold #008000",
+
+ Operator: "#666666",
+
+ Literal: "#ff00ff", # Color literal
+ Name: "#101010",
+ Name.Constant: "bold #800000", # Built-in series 'open', 'high', ...
+ Name.Entity: "bold #008000", # Annotation function
+
+ String: "#BA2121",
+ Number: "#6666FF",
+
+ Error: "border:#FF0000"
+ }
From 4e308299d9035630031eb22d106e56b6c018cd06 Mon Sep 17 00:00:00 2001
From: LucF <50338286+LucFF@users.noreply.github.com>
Date: Sat, 31 Aug 2019 20:16:25 -0400
Subject: [PATCH 2/5] Update README.md
---
resources/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/README.md b/resources/README.md
index 186e392..8b41fb2 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -4,7 +4,7 @@
This document provides a list of Pine-related resources and tools.
-**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research. PineCoders does not benefit from the adoption of these tools and no links to them contain explicit referral information.
+**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research. PineCoders does not benefit from the adoption of these tools. **This document contains no affiliate links.**
> The original version of this list was written by [chrysopoetics](https://www.tradingview.com/u/chrysopoetics/), a TradingView member.
We are grateful to him for allowing us to maintain it. **Thanks Hermes!**
From f3e8f0afeecda4a79c6d9e3bc3f9f7ee436bd40d Mon Sep 17 00:00:00 2001
From: LucF <50338286+LucFF@users.noreply.github.com>
Date: Sat, 31 Aug 2019 20:16:55 -0400
Subject: [PATCH 3/5] Update README.md
---
resources/README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/resources/README.md b/resources/README.md
index 8b41fb2..763154f 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -4,7 +4,8 @@
This document provides a list of Pine-related resources and tools.
-**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research. PineCoders does not benefit from the adoption of these tools. **This document contains no affiliate links.**
+**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research. PineCoders does not benefit from the adoption of these tools.
+**This document contains no affiliate links.**
> The original version of this list was written by [chrysopoetics](https://www.tradingview.com/u/chrysopoetics/), a TradingView member.
We are grateful to him for allowing us to maintain it. **Thanks Hermes!**
From eaaf78030db49922e9447a36b43068bd84c13aba Mon Sep 17 00:00:00 2001
From: LucF <50338286+LucFF@users.noreply.github.com>
Date: Sat, 31 Aug 2019 20:17:42 -0400
Subject: [PATCH 4/5] Update README.md
---
resources/README.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/resources/README.md b/resources/README.md
index 763154f..3e1f073 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -4,8 +4,9 @@
This document provides a list of Pine-related resources and tools.
-**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research. PineCoders does not benefit from the adoption of these tools.
-**This document contains no affiliate links.**
+**Disclaimer**: While we select the tools and resources mentioned here, we do not endorse any of them and their inclusion here does not imply any guarantee of their worthiness. So please, before you decide to purchase anything, show due diligence and do your own research.
+
+PineCoders does not benefit from the adoption of these tools. **This document contains no affiliate links.**
> The original version of this list was written by [chrysopoetics](https://www.tradingview.com/u/chrysopoetics/), a TradingView member.
We are grateful to him for allowing us to maintain it. **Thanks Hermes!**
From ecffa1761f3e9514e9ce7c952394d054febb6350 Mon Sep 17 00:00:00 2001
From: LucF <50338286+LucFF@users.noreply.github.com>
Date: Sat, 31 Aug 2019 20:18:06 -0400
Subject: [PATCH 5/5] Update README.md
---
resources/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/README.md b/resources/README.md
index 3e1f073..a30db76 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -8,7 +8,7 @@ This document provides a list of Pine-related resources and tools.
PineCoders does not benefit from the adoption of these tools. **This document contains no affiliate links.**
-> The original version of this list was written by [chrysopoetics](https://www.tradingview.com/u/chrysopoetics/), a TradingView member.
We are grateful to him for allowing us to maintain it. **Thanks Hermes!**
+> The original version of this document was written by [chrysopoetics](https://www.tradingview.com/u/chrysopoetics/), a TradingView member.
We are grateful to him for allowing us to maintain it. **Thanks Hermes!**
### Table of Contents