npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codincod/codemirror-lang-awk

v0.1.1

Published

AWK language support for the CodeMirror code editor

Readme

@codincod/codemirror-lang-awk NPM version

[ CHANGELOG ]

This package implements AWK language support for the CodeMirror code editor, using a Lezer grammar written for this package.

CodeMirror has never shipped AWK, in either version. Editors that offer it usually reach for a Perl or C mode, which colours the keywords and gets the rest wrong: a regular expression comes out as two divisions, print a > b comes out as a comparison, and there is no tree underneath either way.

Written in part for CodinCod, a competitive coding platform, where it colours the editor people solve puzzles in.

This code is released under an MIT license.

Usage

import {EditorView, basicSetup} from "codemirror"
import {awk} from "@codincod/codemirror-lang-awk"

const view = new EditorView({
  parent: document.body,
  doc: `BEGIN { print "Hello World!" }`,
  extensions: [basicSetup, awk()]
})

Coverage

POSIX AWK, as specified in IEEE 1003.1, with the gawk extensions that are everywhere in practice: switch, delete a, nextfile, **, func, BEGINFILE and ENDFILE, arrays of arrays, the |& coprocess pipe, indirect calls written @f(x), and the @load and @include directives.

Measured against 680 AWK files from Rosetta Code, 89.12% parse with no error node. Most of the rest is not AWK: shell command lines showing how to run the program, and fragments that are a bare if with no rule around them.

Three things AWK decides by position

A character means one thing after a value and another before one, and all three of these are settled by asking the parser what it has room for.

/ opens a regular expression where a value cannot follow, and divides where one can. a / b / c is two divisions; $0 ~ /b/ is a match. The scan handles a / inside a bracket expression, so /[/]/ is one regex.

> redirects where a print can still take a redirection, and compares everywhere else. print a > b writes to the file named by b; comparing the two takes parentheses, which is AWK's own rule rather than this parser's. The same goes for |, which pipes to a command in a print and feeds getline elsewhere.

A newline ends a statement where a statement can end, and is ignored everywhere else. That one rule covers every place AWK allows a line to be broken, so a line may be split after {, &&, , or else with nothing to mark it.

The same question decides - (a sign before a value, subtraction after one), ++ (prefix before, postfix after) and the < in getline line < file.

What it gives an editor

Syntax highlighting, folding for blocks and parameter lists, indentation that knows a brace closes a block and that a braceless body is indented for one statement, and completion for the keywords, the built-in functions and the special variables like NR and FS.

awkLanguage is exported for use with LanguageSupport, and parser for use on its own.

Testing it on your own code

node test/corpus.ts path/to/your/awk

It prints the files that failed, the first line of each that did, and the proportion that came out clean. The corpus itself is not included; Rosetta Code is CC BY-SA and cannot be redistributed under this licence.