Comments (8)
As a reference jsdoc has the same problem. Here is the 10 year old issue:
Many languages seem to just not support nested block comments.
still would be nice if nix did.
Workarounds:
- use html escape sequences (requires some html processing)
- use single line comments
- import from external source in doc-comments (see my nixdoc PR for that)
from nix.
Hi, my name is Francisco and I'm a computer science student that is fascinated by the wonders of Nix. With that being said, I would like to start contributing to the project and think that this could be a good first issue for me to tackle. I've already delved into the codebase an think that the problem might be in the lexical analysis (the Flex file at src/libexpr/lexer.l
). I've looked into some closed issues and merged PR's and don't find many assigned issues. Could I be assigned to this issue, or issue assignments are not really a part of the project's culture? Thanks in advance!
from nix.
@FranciscoTGouveia great to have you! I assigned the issue to you as requested, please add or ping me as a reviewer for PRs.
Note that since we're very conservative with evolving the language, we'll have to make sure that the change is strictly additive and doesn't break existing expressions. We may therefore want to add a test that evaluates past Nixpkgs releases.
from nix.
Concretely, an expression like this may cease to be valid:
# regression.nix /* ignore src/* */ 1
This instance could be mitigated by requiring whitespace to precede the nested comment.
We can't know the true extent of such issues, because of private code bases.
A simpler solution to the doc comments use case is to recommend that the commented text be unescaped by documentation tooling, according to some rules to be specified. For example, nixdoc
could turn *\/
could into */
, but a more complete scheme would be desirable.
EDIT: escaped the wrong end
from nix.
Another idea:
/**
comment
/* nested */
**/
1
Then this would work
# regression.nix
/**
ignore src/*
**/
1
But this would break:
# regression.nix
/**
oh no :/
*/
1
from nix.
Apparently I'm ignorant and full of wishful thinking about how computer languages work, but apparently saying a naive thing such as "the longest sequence of characters between /*
and */
is a comment" is an instance of greedy matching, which would make parsing a lot less efficient.
from nix.
I don't know where you got that, but the longest sequence would also ignore 2
in /**/2/**/
, so I don't think we want that anyway.
If we do the unescaping thing, we can keep the parsing (or lexing) the same as it is today. Unescaping is quite cheap and can be done on demand.
from nix.
@roberth agreed, recommending unescaping is the least invasive and simplest thing to do here.
from nix.
Related Issues (20)
- Can't create sym link '/etc/tmpfiles.d/nix-daemon.conf' HOT 3
- Stability promise, reprodubility properties HOT 2
- explain cache misses HOT 6
- Move examples in classic commands closer to the top
- Tools to update ssl ca break HOT 2
- flakes: input is updated on upgrade if repo owner capitalization is changed HOT 4
- {extra-,}experimental-features in flake nixConfig ignored HOT 2
- Update xmonad to 0.18.0 HOT 2
- builtins.fetchGit fails with .gitmodules entries that aren't submodules HOT 2
- Recursion in `builders` definitions deadlocks builds with `waiting for lock on '/nix/store/...'` HOT 5
- Investigate using FUSE HOT 1
- nixos.org is out of date wrt latest Nix release HOT 3
- dont ignore the CFLAGS from pkg-config check for libseccomp. HOT 4
- Darwin installer: create a case sensitive APFS volume HOT 6
- run nix in a non root container in openshift - restricted SCC HOT 5
- `nix build` breaks inside `nix develop`
- install.in: fails to run the installer with `noexec` HOT 2
- `nix build --system` don't use remote builder HOT 6
- `StoreReference` -> `<Name>StoreConfig` -> `<Name>Store` HOT 2
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 nix.