![]() ![]() We also know that end marks the end of a method, closing the function defining a scope. We know that def is a keyword that marks the beginning of a method and that it is followed by a string that forms the name of the method. Take the following method written in Ruby as an example: The keywords are well defined, and the rules on what constitutes a boundary or a scope are clear. Most programming languages are very well structured. In summary, a grammar is heavily based on matching keywords and deriving scope from them. It does that by assigning properties to the parts that are matched against specific rules those properties are later interpreted by the editor, including properties that define scopes (for code folding for example). The colors are brought in by the Syntax Themes.Ī grammar is basically a set of rules that tells the editor what the role of each part of a text is. ![]() A Grammar has no concept of colors, its only job is to assign properties to parts of the text matched against its patterns. I learned early on my quest that the part of a syntax highlighter I needed to write was called a Grammar. When I started thinking about writing a syntax highlighter, Atom was the obvious choice for me. Atom was brought to life by GitHub, with the tagline “a hackable text editor for the 21st Century.” I started using Atom very early, and also made some small contributions to the main packages. ![]() There are many text editors out there, some have been around for decades (Vim was first released in 1991), others, like Atom, are very recent (open sourced in 2014). Neat? Allow me to give you some background and walk you through the basics of syntax highlighting. Here’s what a piece of syntax highlighted configuration looks like: So, a while ago I set out to fix that and created the language-cisco package for the Atom editor and placed it in the DevNet Code Exchange. Syntax highlighting is one of those advantages, and – being also a developer – it was something I missed when dealing with network configurations. Still, they share many similarities, and there are various advantages in treating configuration as code. The commands we use to configure our Cisco devices are not exactly a programming language. Advantages of treating network configuration as code Coloring source code is called syntax highlighting, and it exists not just to make our screens look like a text-based candy crush, the main idea is to improve readability and to make it easier to derive context from an otherwise monochromatic block of text. If you walk into a room full of developers, there is one thing you’ll quickly notice on their screens - multicolored text. Guest Author: Diogo Andre de Assumpcao is a network engineer working on network reliability and automation, and has a deep passion for writing code. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |