colis-anr / morbig

A static parser for POSIX Shell
Other
192 stars 8 forks source link

Glob parser #65

Closed yurug closed 5 years ago

yurug commented 5 years ago

This PR is an attempt to implement pattern matching recognition.

Fixes #55.

yurug commented 5 years ago

Regarding this part of the standard:

[
If an open bracket introduces a bracket expression as in XBD RE Bracket Expression, except that the 
<exclamation-mark> character ( '!' ) shall replace the <circumflex> character ( '^' ) in its role in a non-
matching list in the regular expression notation, it shall introduce a pattern bracket expression. A bracket 
expression starting with an unquoted <circumflex> character produces unspecified results. Otherwise, '[' 
shall match the character itself.

I did not choose to interpret ^ as ! even if the semantics of ^ is unspecified by the standard. bash and dash took a different path, choosing to see ^ as !.

@nios @treinen, do you agree with that design choice?

treinen commented 5 years ago

I think it s the right decision to follow the POSIX standard. However, it might be worth to add in the future an option to morbig, like "--error-on-unspecified", which makes morbig produce an error (or at least a warning) when the syntactic structure of an input script depends on a decision which is explicitely labeled as unspecified in the standard.

So, OK to merge for now and leave that option as a feature request for the future.

yurug commented 5 years ago

I have implemented the command line option you suggested @treinen.

treinen commented 5 years ago

On Fri, Feb 22, 2019 at 05:31:07AM -0800, Nicolas Jeannerod wrote:

Niols commented on this pull request.

@@ -1,3 +1,16 @@ +(**) +( -- tuareg -- ) +( ) +( Copyright (C) 2017,2018 Yann Régis-Gianas, Nicolas Jeannerod, )

@treinen Maybe we should run headache before releasing? To have 2017-2019?

Done (on the master branch only). -Ralf. -- Ralf Treinen Institut de Recherche en Informatique Fondamentale Équipe Preuves, Programmes et Systèmes Université Paris Diderot, Paris, France. http://www.irif.fr/~treinen/

Niols commented 5 years ago

@yurug I have nothing more to say about this PR. imho, it can be merged (we'd still have to wait for the CI to go green).

Niols commented 5 years ago

CI is happy and so am I.

yurug commented 5 years ago

Great! Let's merge then once the green lights are here.

Niols commented 5 years ago

They are. It's just the GitHub-Travis hook that failed. But if you click on details, everything is fine.