Comments (10)
https://gist.github.com/kylebarron/e46ce79911976c3aae9d7e98309b9222
from stata_kernel.
@mcaceresb Check out https://github.com/kylebarron/stata_kernel/blob/dev-stata-lexer/stata_kernel/stata_lexer.py
from stata_kernel.
I believe I've implemented correct comments. Working on strings then writing some tests.
from stata_kernel.
And yes I know some of those regexes could be cleaned up. It was mostly a port from language-stata.
from stata_kernel.
One issue that comes to mind with the lexer is that *
in mata de-references a pointer, and is not a comment. I wonder if it has a way to implement different rules for different environments (this might also come in handy for #delimit ;
, where the notion of a line changes).
from stata_kernel.
Yes that should be possible. Since Mata is only started with mata
and ended with end
(is this true?), I can easily find when Mata starts and ends and then just write a different lexer for Mata and use the Mata tokenizer on the Mata code.
from stata_kernel.
You need to be careful in that
mata
can be preceded by any number ofCAPture
,QUIetly
, orNoisily
mata
can be followed by any number of spaces,:
, and any number of spaces thereafter.- If there is anything else following mata, it is evaluated inline, and does not enter the mata environment
end
can be preceded by any number of spaces and followed by anything- It doesn't matter where
end
appears. In a loop, a function, etc. The mata environment will end at that point. mata
is not nested, asmata
itself is a validmata
command.
from stata_kernel.
Thanks. I'll have to look at the mata syntax more closely.
from stata_kernel.
Comments are just C-style comments, except they can be nested. Rules for locals, etc. are the same. I don't think there is much to look out for within a mata block per se, other than the prompts are different.
from stata_kernel.
I'll come back to Mata once I progress on some other stuff. You're welcome to submit a PR with a Mata lexer if you'd like. All it needs to support is comments and strings.
from stata_kernel.
Related Issues (20)
- Graphs do not show with stata 17 HOT 5
- Graphs not displaying on JupyterLab with Stata 17 HOT 1
- Ubuntu run pytest get "stata_path option in configuration file is missing or invalid"
- Kernel does not recover after stata process is killed
- Atom and stata_kernel togther with Hydrogen -- not executing HOT 4
- Is stata kernel able to install in Mac OS? HOT 1
- Issues with stata_kernel in Atom (Hydrogen) HOT 3
- Graph display bug after setting user _graph_keywords? HOT 34
- Update kernel's python dependencies HOT 1
- Kernel does not execute then `*` is used within multi-line `syntax` statement
- Use importlib.resources instead of pkg_resources
- Repo modernization HOT 1
- How to make jupyter automatically close the stata session HOT 1
- %help magic does not work for Stata commands HOT 2
- The word "format" appears below stata plot output
- Graphs no longer display in Jupyter notebook HOT 9
- Kernel freezes whenever I try to run some code HOT 2
- can't run arch model. HOT 2
- How can i make the results more beautiful. HOT 2
- can we insert a graph on the local path using markdown?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stata_kernel.